Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Use real code block macros

 

These facilities were developed separately for JSPUI and XMLUI.

Table of Contents
minLevel2
outlinetrue
stylenone

These facilities were developed separately for JSPUI and XMLUI.

Using JSPUI

Info

This functionality is an extension of that provided by Importing and Exporting Items via Simple Archive Format so please read that section before continuing. It is underpinned by the Biblio Transformation Engine (https://github.com/EKT/Biblio-Transformation-Engine    )

...

Introduction

This documentation explains the features and the usage of the importer framework.

...

When using an implementation of AbstractImportSourceService, a mapping of remote record fields to DSpace metadata fields can be created.  First create an implementation of class AbstractMetadataFieldMapping with the same type set used for the importer implementation.  Then create a Spring configuration file in [dspace.dir]/config/spring/api.  Each DSpace metadata field that will be used for the mapping must first be configured as a spring bean of class org.dspace.importer.external.metadatamapping.MetadataFieldConfig. 

Code Block
language

...

xml

...

<bean id="dc.title" class="org.dspace.importer.external.metadatamapping.MetadataFieldConfig">

...

    <constructor-arg value="dc.title"/>

...

</bean>

...

 

Now this metadata field can be used to create a mapping. To add a mapping for the "dc.title" field declared above, a new spring bean configuration of a class class org.dspace.importer.external.metadatamapping.contributor.MetadataContributor needs to be added. This interface contains a type argument. The type needs to match the type used in the implementation of AbstractImportSourceService. The responsibility of each MetadataContributor implementation is to generate a set of metadata from the retrieved document. How it does that is completely opaque to the AbstractImportSourceService but it is assumed that only one entity (i.e. item) is fed to the metadatum contributor.

...

  • field: A reference to the configured spring bean of the DSpace metadata field. e.g. the "dc.title" bean declared above.
  • query: The xpath expression used to select the record value returned by the remote source.

 

...

Code Block
languagexml
<bean id="titleContrib" class="org.dspace.importer.external.metadatamapping.contributor.SimpleXpathMetadatumContributor">
    

...

<property name="field" ref="dc.title"/>
    

...

<property name="query" value="dc:title"/>

...

</bean>

...

 

Multiple record fields can also be combined into one value. To implement a combined mapping first create a SimpleXpathMetadatumContributor as explained above for each part of the field.

...

Code Block
languagexml
<bean id="lastNameContrib" class="org.dspace.importer.external.metadatamapping.contributor.SimpleXpathMetadatumContributor">

...

    

...

<property name="field" ref="dc.contributor.author"/>
    

...

<property name="query" value="x:authors/x:author/x:surname"/>

...

</bean>

...

<bean id="firstNameContrib" class="org.dspace.importer.external.metadatamapping.contributor.SimpleXpathMetadatumContributor">
    

...

<property name="field" ref="dc.contributor.author"/>
    

...

<property name="query" value="x:authors/x:author/x:given-name"/>

...

</bean>

...

 

Note that namespace prefixes used in the xpath queries are configured in bean "FullprefixMapping" in the same spring file.

...

Code Block
languagexml
<util:map id="FullprefixMapping" key-type="java.lang.String" value-type="java.lang.String">

...

    

...

<description>Defines the namespace mappin for the SimpleXpathMetadatum contributors</description>
    

...

<entry key="http://purl.org/dc/elements/1.1/" value="dc"/>
    

...

<entry key="http://www.w3.org/2005/Atom" value="x"/>

...

</util:map>

...

 

Then create a new list in the spring configuration containing references to all SimpleXpathMetadatumContributor beans that need to be combined.

...

Code Block
languagexml
<util:list id="combinedauthorList" value-type="org.dspace.importer.external.metadatamapping.contributor.MetadataContributor" list-class="java.util.LinkedList">
    

...

<ref bean="lastNameContrib"/>
    <ref 

...

bean="firstNameContrib"/>

...

</util:list>

...

 

Finally create a Spring bean configuration of class org.dspace.importer.external.metadatamapping.contributor.CombinedMetadatumContributor. This bean expects 3 values:

  • field: A reference to the configured spring bean of the DSpace metadata field. e.g. the "dc.title" bean declared above.
  • metadatumContributors: A reference to the list containing all the single record field mappings that need to be combined.
  • separator: These characters will be added between each record field value when they are combined into one field.

...

 
Code Block
languagexml
<bean id="authorContrib" class="org.dspace.importer.external.metadatamapping.contributor.CombinedMetadatumContributor">

...

    

...

<property name="separator" value=", "/>
    

...

<property name="metadatumContributors" ref="combinedauthorList"/>

...

    <property name="field" ref="dc.contributor.author"/>

...

</bean>

...

 

Each contributor must also be added to the "MetadataFieldMap" used by the MetadataFieldMapping implementation. Each entry of this map maps a metadata field bean to a contributor. For the contributors created above this results in the following configuration:

...

Code Block
languagexml
<util:map id="org.dspace.importer.external.metadatamapping.MetadataFieldConfig"

...

		  

...

value-type="org.dspace.importer.external.metadatamapping.contributor.MetadataContributor">

...

	<entry key-ref="dc.title" value-ref="titleContrib"/>

...

	<entry key-ref="dc.contributor.author" value-ref="authorContrib"/>

...

</util:map>

...

Note that the single field mappings used for the combined author mapping are not added to this list.