Mapper
From DISMARC Help
(Difference between revisions)
Line 4: | Line 4: | ||
A mapper is capable of doing some things to your XML. This topic is quite technical for the AbstractDismarcImporter is discussed here. | A mapper is capable of doing some things to your XML. This topic is quite technical for the AbstractDismarcImporter is discussed here. | ||
+ | |||
+ | Class [ <user> abstract class AbstractDismarcMapper extends AbstractMapper ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/mapper/dismarc/AbstractDismarcMapper.php 5-56 | ||
+ | |||
+ | - Constants [0] { | ||
+ | } | ||
+ | |||
+ | - Static properties [0] { | ||
+ | } | ||
+ | |||
+ | - Static methods [0] { | ||
+ | } | ||
+ | |||
+ | - Properties [0] { | ||
+ | } | ||
+ | |||
+ | - Methods [20] { | ||
+ | Method [ <user, overwrites AbstractMapper, ctor> public method __construct ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/mapper/dismarc/AbstractDismarcMapper.php 7 - 9 | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Parses a string into a date and returns a value suitable for the dmEras thesaurus or empty string | ||
+ | * | ||
+ | * @param String $date | ||
+ | * @return String | ||
+ | */ | ||
+ | Method [ <user> protected method getYearForDmEras ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/mapper/dismarc/AbstractDismarcMapper.php 17 - 54 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $date ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Method [ <user, inherits AbstractMapper> public method setAdditionalSubstFile ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 34 - 43 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $file ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Adds the approriate thesaurus fields to the record | ||
+ | * | ||
+ | * @param String $thesaurus | ||
+ | * @param String $term | ||
+ | * @param MdmMappedDocument $mdoc | ||
+ | * @param String $section | ||
+ | * @param String $fieldname | ||
+ | * @param String $setAtt which attribute shall hold the thesaurus name | ||
+ | * @param boolean $addIfNotFound add the searchterm if the thesaurusterm was not found | ||
+ | * @param GetTreeNodeScope $scopeNode | ||
+ | * @return boolean | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method lookupThesaurus ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 58 - 181 | ||
+ | |||
+ | - Parameters [8] { | ||
+ | Parameter #0 [ <required> $thesaurus ] | ||
+ | Parameter #1 [ <required> $term ] | ||
+ | Parameter #2 [ <required> $mdoc ] | ||
+ | Parameter #3 [ <required> $section ] | ||
+ | Parameter #4 [ <required> $fieldname ] | ||
+ | Parameter #5 [ <optional> $setAtt = 'encoding' ] | ||
+ | Parameter #6 [ <optional> $addIfNotFound = false ] | ||
+ | Parameter #7 [ <optional> GetTreeNodeScope or NULL $scopeNode = NULL ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * language for thesaurus terms | ||
+ | * | ||
+ | * @param String $lang iso3 | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method setLang ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 188 - 190 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $lang ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Method [ <user, inherits AbstractMapper> public method getLang ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 192 - 194 | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Maps records gathered from AbstractRecordReader to valid MDM Docs | ||
+ | * | ||
+ | * @param DOMDocument $doc | ||
+ | * @param Boolean $appendRawData | ||
+ | * @return [DOMDocument] | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method map ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 203 - 229 | ||
+ | |||
+ | - Parameters [2] { | ||
+ | Parameter #0 [ <required> DOMDocument $doc ] | ||
+ | Parameter #1 [ <optional> $appendRawData = true ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * checks if the document is valid or not by writing the XML and pasing it again | ||
+ | * | ||
+ | * @param DOMDocument $doc | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> private method checkDoc ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 236 - 250 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $doc ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param DOMDocument $doc | ||
+ | * @return MdmMappedDocument | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> abstract protected method map_ ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 256 - 256 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> DOMDocument $doc ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * | ||
+ | * @param array $descrDoc | ||
+ | * | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method setFieldHierarchy ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 263 - 275 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $hierarchy ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Is no collection specified during the mapping, this collection will be used | ||
+ | * | ||
+ | * @param String $collection | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method setDefaultCollection ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 282 - 284 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $collection ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param String $string | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method stdout ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 289 - 295 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $string ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param String $string | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method stderr ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 299 - 305 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $string ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param Boolean $verbose | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method setVerbose ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 310 - 312 | ||
+ | |||
+ | - Parameters [1] { | ||
+ | Parameter #0 [ <required> $verbose ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @return MdmMappedDocument | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> protected method getNewMappedDoc ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 317 - 322 | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param NamedArray $array | ||
+ | * @param String &$io_text | ||
+ | * @param String[] &$io_found | ||
+ | * @param String[] $keep | ||
+ | * @param String $seperator | ||
+ | * @param String $lencl | ||
+ | * @param String $rencl | ||
+ | * @return Boolean if something was found | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> protected method findInString ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 334 - 367 | ||
+ | |||
+ | - Parameters [7] { | ||
+ | Parameter #0 [ <required> &$array ] | ||
+ | Parameter #1 [ <required> &$io_text ] | ||
+ | Parameter #2 [ <required> &$io_found ] | ||
+ | Parameter #3 [ <optional> $keep = Array ] | ||
+ | Parameter #4 [ <optional> $seperator = ',' ] | ||
+ | Parameter #5 [ <optional> $lencl = '[' ] | ||
+ | Parameter #6 [ <optional> $rencl = ']' ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param NamedArray $array | ||
+ | * @param String &$io_text | ||
+ | * @param String $seperator | ||
+ | * @param String $lencl | ||
+ | * @param String $rencl | ||
+ | * @return Boolean if something was found | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> protected method replaceInString ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 377 - 410 | ||
+ | |||
+ | - Parameters [5] { | ||
+ | Parameter #0 [ <required> &$array ] | ||
+ | Parameter #1 [ <required> &$io_text ] | ||
+ | Parameter #2 [ <optional> $seperator = ',' ] | ||
+ | Parameter #3 [ <optional> $lencl = '[' ] | ||
+ | Parameter #4 [ <optional> $rencl = ']' ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @param String $filename filename of the substitutionfile | ||
+ | * @param boolean $override shall old files be overwritten | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method loadSubstitutionfile ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 417 - 460 | ||
+ | |||
+ | - Parameters [2] { | ||
+ | Parameter #0 [ <required> $filename ] | ||
+ | Parameter #1 [ <optional> $override = false ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * returns the substituted value of if $defualt is set to null and no term was found, the term will be returned | ||
+ | * | ||
+ | * @param String $field | ||
+ | * @param String $namespace | ||
+ | * @param String $term | ||
+ | * @return Array | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method getFromSubstitution ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 470 - 488 | ||
+ | |||
+ | - Parameters [4] { | ||
+ | Parameter #0 [ <required> $field ] | ||
+ | Parameter #1 [ <required> $namespace ] | ||
+ | Parameter #2 [ <required> $term ] | ||
+ | Parameter #3 [ <optional> $default = NULL ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Returns the array needed for the findInString function from the substitutiontable | ||
+ | * | ||
+ | * @param String $field | ||
+ | * @param String $namespace | ||
+ | * @param Array $ioArray | ||
+ | * @param array $ioKeey | ||
+ | */ | ||
+ | Method [ <user, inherits AbstractMapper> public method getForFindInStringFromSubstitution ] { | ||
+ | @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 498 - 514 | ||
+ | |||
+ | - Parameters [4] { | ||
+ | Parameter #0 [ <required> $field ] | ||
+ | Parameter #1 [ <required> $namespace ] | ||
+ | Parameter #2 [ <required> &$ioArray ] | ||
+ | Parameter #3 [ <required> &$ioKeey ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } |
Revision as of 08:07, 20 August 2008
Mappers are part of an Importer. They convert the XML they get from a Reader and try to create an XML that fulfills the DISMARC application profile.
Each archive needs it's own mapper, except if they use a predefined format like MAB, OAI and so on.
A mapper is capable of doing some things to your XML. This topic is quite technical for the AbstractDismarcImporter is discussed here.
Class [ <user> abstract class AbstractDismarcMapper extends AbstractMapper ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/mapper/dismarc/AbstractDismarcMapper.php 5-56 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [20] { Method [ <user, overwrites AbstractMapper, ctor> public method __construct ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/mapper/dismarc/AbstractDismarcMapper.php 7 - 9 } /** * Parses a string into a date and returns a value suitable for the dmEras thesaurus or empty string * * @param String $date * @return String */ Method [ <user> protected method getYearForDmEras ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/mapper/dismarc/AbstractDismarcMapper.php 17 - 54 - Parameters [1] { Parameter #0 [ <required> $date ] } } Method [ <user, inherits AbstractMapper> public method setAdditionalSubstFile ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 34 - 43 - Parameters [1] { Parameter #0 [ <required> $file ] } } /** * Adds the approriate thesaurus fields to the record * * @param String $thesaurus * @param String $term * @param MdmMappedDocument $mdoc * @param String $section * @param String $fieldname * @param String $setAtt which attribute shall hold the thesaurus name * @param boolean $addIfNotFound add the searchterm if the thesaurusterm was not found * @param GetTreeNodeScope $scopeNode * @return boolean */ Method [ <user, inherits AbstractMapper> public method lookupThesaurus ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 58 - 181 - Parameters [8] { Parameter #0 [ <required> $thesaurus ] Parameter #1 [ <required> $term ] Parameter #2 [ <required> $mdoc ] Parameter #3 [ <required> $section ] Parameter #4 [ <required> $fieldname ] Parameter #5 [ <optional> $setAtt = 'encoding' ] Parameter #6 [ <optional> $addIfNotFound = false ] Parameter #7 [ <optional> GetTreeNodeScope or NULL $scopeNode = NULL ] } } /** * language for thesaurus terms * * @param String $lang iso3 */ Method [ <user, inherits AbstractMapper> public method setLang ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 188 - 190 - Parameters [1] { Parameter #0 [ <required> $lang ] } } Method [ <user, inherits AbstractMapper> public method getLang ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 192 - 194 } /** * Maps records gathered from AbstractRecordReader to valid MDM Docs * * @param DOMDocument $doc * @param Boolean $appendRawData * @return [DOMDocument] */ Method [ <user, inherits AbstractMapper> public method map ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 203 - 229 - Parameters [2] { Parameter #0 [ <required> DOMDocument $doc ] Parameter #1 [ <optional> $appendRawData = true ] } } /** * checks if the document is valid or not by writing the XML and pasing it again * * @param DOMDocument $doc */ Method [ <user, inherits AbstractMapper> private method checkDoc ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 236 - 250 - Parameters [1] { Parameter #0 [ <required> $doc ] } } /** * @param DOMDocument $doc * @return MdmMappedDocument */ Method [ <user, inherits AbstractMapper> abstract protected method map_ ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 256 - 256 - Parameters [1] { Parameter #0 [ <required> DOMDocument $doc ] } } /** * * @param array $descrDoc * */ Method [ <user, inherits AbstractMapper> public method setFieldHierarchy ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 263 - 275 - Parameters [1] { Parameter #0 [ <required> $hierarchy ] } } /** * Is no collection specified during the mapping, this collection will be used * * @param String $collection */ Method [ <user, inherits AbstractMapper> public method setDefaultCollection ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 282 - 284 - Parameters [1] { Parameter #0 [ <required> $collection ] } } /** * @param String $string */ Method [ <user, inherits AbstractMapper> public method stdout ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 289 - 295 - Parameters [1] { Parameter #0 [ <required> $string ] } } /** * @param String $string */ Method [ <user, inherits AbstractMapper> public method stderr ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 299 - 305 - Parameters [1] { Parameter #0 [ <required> $string ] } } /** * @param Boolean $verbose */ Method [ <user, inherits AbstractMapper> public method setVerbose ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 310 - 312 - Parameters [1] { Parameter #0 [ <required> $verbose ] } } /** * @return MdmMappedDocument */ Method [ <user, inherits AbstractMapper> protected method getNewMappedDoc ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 317 - 322 } /** * @param NamedArray $array * @param String &$io_text * @param String[] &$io_found * @param String[] $keep * @param String $seperator * @param String $lencl * @param String $rencl * @return Boolean if something was found */ Method [ <user, inherits AbstractMapper> protected method findInString ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 334 - 367 - Parameters [7] { Parameter #0 [ <required> &$array ] Parameter #1 [ <required> &$io_text ] Parameter #2 [ <required> &$io_found ] Parameter #3 [ <optional> $keep = Array ] Parameter #4 [ <optional> $seperator = ',' ] Parameter #5 [ <optional> $lencl = '[' ] Parameter #6 [ <optional> $rencl = ']' ] } } /** * @param NamedArray $array * @param String &$io_text * @param String $seperator * @param String $lencl * @param String $rencl * @return Boolean if something was found */ Method [ <user, inherits AbstractMapper> protected method replaceInString ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 377 - 410 - Parameters [5] { Parameter #0 [ <required> &$array ] Parameter #1 [ <required> &$io_text ] Parameter #2 [ <optional> $seperator = ',' ] Parameter #3 [ <optional> $lencl = '[' ] Parameter #4 [ <optional> $rencl = ']' ] } } /** * @param String $filename filename of the substitutionfile * @param boolean $override shall old files be overwritten */ Method [ <user, inherits AbstractMapper> public method loadSubstitutionfile ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 417 - 460 - Parameters [2] { Parameter #0 [ <required> $filename ] Parameter #1 [ <optional> $override = false ] } } /** * returns the substituted value of if $defualt is set to null and no term was found, the term will be returned * * @param String $field * @param String $namespace * @param String $term * @return Array */ Method [ <user, inherits AbstractMapper> public method getFromSubstitution ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 470 - 488 - Parameters [4] { Parameter #0 [ <required> $field ] Parameter #1 [ <required> $namespace ] Parameter #2 [ <required> $term ] Parameter #3 [ <optional> $default = NULL ] } } /** * Returns the array needed for the findInString function from the substitutiontable * * @param String $field * @param String $namespace * @param Array $ioArray * @param array $ioKeey */ Method [ <user, inherits AbstractMapper> public method getForFindInStringFromSubstitution ] { @@ /srv/www/htdocs/dismarc/metastore/classes/importparser/AbstractMapper.php 498 - 514 - Parameters [4] { Parameter #0 [ <required> $field ] Parameter #1 [ <required> $namespace ] Parameter #2 [ <required> &$ioArray ] Parameter #3 [ <required> &$ioKeey ] } } } }