Mapper
From DISMARC Help
(Difference between revisions)
(2 intermediate revisions not shown.) | |||
Line 3: | Line 3: | ||
Each archive needs it's own mapper, except if they use a predefined format like MAB, OAI and so on. | 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. | + | A mapper is capable of doing some things to your XML. The AbstractDismarcImporter is described in the following section. |
- | + | abstract class AbstractDismarcMapper extends AbstractMapper [ <user> ] { | |
- | + | public method __construct [ <user, overwrites AbstractMapper, ctor> ] | |
/** | /** | ||
Line 15: | Line 15: | ||
* @return String | * @return String | ||
*/ | */ | ||
- | + | protected method getYearForDmEras [ <user> ] | |
- | + | public method setAdditionalSubstFile [ <user, inherits AbstractMapper> ] | |
- | + | ||
/** | /** | ||
Line 33: | Line 32: | ||
* @return boolean | * @return boolean | ||
*/ | */ | ||
- | + | public method lookupThesaurus [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 40: | Line 39: | ||
* @param String $lang iso3 | * @param String $lang iso3 | ||
*/ | */ | ||
- | + | public method setLang [ <user, inherits AbstractMapper> ] | |
- | + | public method getLang [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 51: | Line 50: | ||
* @return [DOMDocument] | * @return [DOMDocument] | ||
*/ | */ | ||
- | + | public method map [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 58: | Line 57: | ||
* @param DOMDocument $doc | * @param DOMDocument $doc | ||
*/ | */ | ||
- | + | private method checkDoc [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 64: | Line 63: | ||
* @return MdmMappedDocument | * @return MdmMappedDocument | ||
*/ | */ | ||
- | + | abstract protected method map_ [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 71: | Line 70: | ||
* | * | ||
*/ | */ | ||
- | + | public method setFieldHierarchy [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 78: | Line 77: | ||
* @param String $collection | * @param String $collection | ||
*/ | */ | ||
- | + | public method setDefaultCollection [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
* @param String $string | * @param String $string | ||
*/ | */ | ||
- | + | public method stdout [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
* @param String $string | * @param String $string | ||
*/ | */ | ||
- | + | public method stderr [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
* @param Boolean $verbose | * @param Boolean $verbose | ||
*/ | */ | ||
- | + | public method setVerbose [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
* @return MdmMappedDocument | * @return MdmMappedDocument | ||
*/ | */ | ||
- | + | protected method getNewMappedDoc [ <user, inherits AbstractMapper> ] | |
- | + | ||
/** | /** | ||
* @param NamedArray $array | * @param NamedArray $array | ||
Line 110: | Line 109: | ||
* @return Boolean if something was found | * @return Boolean if something was found | ||
*/ | */ | ||
- | + | protected method findInString [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 120: | Line 119: | ||
* @return Boolean if something was found | * @return Boolean if something was found | ||
*/ | */ | ||
- | + | protected method replaceInString [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 126: | Line 125: | ||
* @param boolean $override shall old files be overwritten | * @param boolean $override shall old files be overwritten | ||
*/ | */ | ||
- | + | public method loadSubstitutionfile [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 136: | Line 135: | ||
* @return Array | * @return Array | ||
*/ | */ | ||
- | + | public method getFromSubstitution [ <user, inherits AbstractMapper> ] | |
/** | /** | ||
Line 146: | Line 145: | ||
* @param array $ioKeey | * @param array $ioKeey | ||
*/ | */ | ||
- | + | public method getForFindInStringFromSubstitution [ <user, inherits AbstractMapper> ] | |
} | } |
Current revision
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. The AbstractDismarcImporter is described in the following section.
abstract class AbstractDismarcMapper extends AbstractMapper [ <user> ] { public method __construct [ <user, overwrites AbstractMapper, ctor> ] /** * Parses a string into a date and returns a value suitable for the dmEras thesaurus or empty string * * @param String $date * @return String */ protected method getYearForDmEras [ <user> ] public method setAdditionalSubstFile [ <user, inherits AbstractMapper> ] /** * 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 */ public method lookupThesaurus [ <user, inherits AbstractMapper> ] /** * language for thesaurus terms * * @param String $lang iso3 */ public method setLang [ <user, inherits AbstractMapper> ] public method getLang [ <user, inherits AbstractMapper> ] /** * Maps records gathered from AbstractRecordReader to valid MDM Docs * * @param DOMDocument $doc * @param Boolean $appendRawData * @return [DOMDocument] */ public method map [ <user, inherits AbstractMapper> ] /** * checks if the document is valid or not by writing the XML and pasing it again * * @param DOMDocument $doc */ private method checkDoc [ <user, inherits AbstractMapper> ] /** * @param DOMDocument $doc * @return MdmMappedDocument */ abstract protected method map_ [ <user, inherits AbstractMapper> ] /** * * @param array $descrDoc * */ public method setFieldHierarchy [ <user, inherits AbstractMapper> ] /** * Is no collection specified during the mapping, this collection will be used * * @param String $collection */ public method setDefaultCollection [ <user, inherits AbstractMapper> ] /** * @param String $string */ public method stdout [ <user, inherits AbstractMapper> ] /** * @param String $string */ public method stderr [ <user, inherits AbstractMapper> ] /** * @param Boolean $verbose */ public method setVerbose [ <user, inherits AbstractMapper> ] /** * @return MdmMappedDocument */ protected method getNewMappedDoc [ <user, inherits AbstractMapper> ] /** * @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 */ protected method findInString [ <user, inherits AbstractMapper> ] /** * @param NamedArray $array * @param String &$io_text * @param String $seperator * @param String $lencl * @param String $rencl * @return Boolean if something was found */ protected method replaceInString [ <user, inherits AbstractMapper> ] /** * @param String $filename filename of the substitutionfile * @param boolean $override shall old files be overwritten */ public method loadSubstitutionfile [ <user, inherits AbstractMapper> ] /** * 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 */ public method getFromSubstitution [ <user, inherits AbstractMapper> ] /** * Returns the array needed for the findInString function from the substitutiontable * * @param String $field * @param String $namespace * @param Array $ioArray * @param array $ioKeey */ public method getForFindInStringFromSubstitution [ <user, inherits AbstractMapper> ] }