Mapper

From DISMARC Help

(Difference between revisions)
Jump to: navigation, search
(New page: A mapper are part of an Importer. They convert the XML they get from a Reader and try to create an XML that fulfils the DISMARC application profile. Each archives needs it's own m...)
Current revision (07:50, 26 August 2008) (edit) (undo)
 
(7 intermediate revisions not shown.)
Line 1: Line 1:
-
A mapper are part of an [[Importer]]. They convert the XML they get from a [[Reader]] and try to create an XML that fulfils the DISMARC application profile.
+
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 archives needs it's own mapper, except 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 capeable of doning some things to your XML. Since this topic is quite technical, we show this with an example.
+
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> ] {
-
... TODO ...
+
 +
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> ]
 +
}

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>  ] 
}
Personal tools