All Versions
- DSpace 7.x (Current Release)
- DSpace 8.x (Unreleased)
- DSpace 6.x (EOL)
- DSpace 5.x (EOL)
- More Versions...
Contribute to the DSpace Development Fund
The newly established DSpace Development Fund supports the development of new features prioritized by DSpace Governance. For a list of planned features see the fund wiki page.
This framework is used by both the REST API and User Interface to help enhance or enrich submissions. See also Importing Items via basic bibliographic formats (Endnote, BibTex, RIS, TSV, CSV) and online services (OAI, arXiv, PubMed, CrossRef, CiNii)
The importer framework does not enforce a specific input format. Each importer implementation defines which input format it expects from a remote source. The import framework uses generics to achieve this. Each importer implementation will have a type set of the record type it receives from the remote source's response. This type set will also be used by the framework to use the correct MetadataFieldMapping for a certain implementation. Read Implementation of an import source for more information and how to enable the framework.
The framework produces an 'ImportRecord' that is completely decoupled from DSpace. It contains a set of metadata DTO's that contain the notion of schema,element and qualifier. The specific implementation is responsible for populating this set. It is then very simple to create a DSpace item from this list.
Each importer implementation must at least implement interface org.dspace.importer.external.service.components.MetadataSource and implement the inherited methods.
One can also choose to implement class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource next to the MetadataSource interface. This class contains functionality to handle request timeouts and to retry requests.
A third option is to implement class org.dspace.importer.external.service.AbstractImportSourceService. This class already implements both the MetadataSource interface and Source class. AbstractImportSourceService has a generic type set 'RecordType'. In the importer implementation this type set should be the class of the records received from the remote source's response (e.g. when using axiom to get the records from the remote source's XML response, the importer implementation's type set isorg.apache.axiom.om.OMElement).
Implementing the AbstractImportSourceService allows the importer implementation to use the framework's build-in support to transform a record received from the remote source to an object of class *org.dspace.importer.external.datamodel.ImportRecord containing DSpace metadata fields, as explained here: Metadata mapping.
Method getImportSource() should return a unique identifier. Importer implementations should not be called directly, but class org.dspace.importer.external.service.ImportService should be called instead. This class contains the same methods as the importer implementations, but with an extra parameter 'url'. This url parameter should contain the same identifier that is returned by the getImportSource() method of the importer implementation you want to use.
The other inherited methods are used to query the remote source.
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 classorg.dspace.importer.external.metadatamapping.MetadataFieldConfig.
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.
For example java SimpleXpathMetadatumContributor implements MetadataContributor<OMElement>
can parse a fragment of xml and generate one or more metadata values.
This bean expects 2 property values:
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.
Note that namespace prefixes used in the xpath queries are configured in bean "FullprefixMapping" in the same spring file.
Finally create a spring bean configuration of classorg.dspace.importer.external.metadatamapping.contributor.CombinedMetadatumContributor. This bean expects 3 values:
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:
Note that the single field mappings used for the combined author mapping are not added to this list.
First read the base documentation on external importing This documentation explains the implementation of the importer framework using PubMed (http://www.ncbi.nlm.nih.gov/pubmed) as an example.
To be able to do the lookup for our configured import-service, we need to be able to know what URL to use to check for publications. This URL the publication-lookup.url
setting defined within the [dspace.dir]/config/modules/publication-lookup.cfg
. You may choose to modify this setting or override it within your local.cfg.
This setting can be modified in one of two ways:
baseAddress
for beans within the [src]/dspace-api/src/main/resources/spring/spring-dspace-addon-import-services.xml
Spring config file.publication-lookup.url=http://eutils.ncbi.nlm.nih.gov/entrez/eutils/
publication-lookup.url
is set to an asterisk ('*'). This default value will attempt to lookup the publication using ALL configured importServices in the [src]/dspace-api/src/main/resources/spring/spring-dspace-addon-import-services.xml
Spring config fileThe PubMed metadata mappings are defined in the [dspace.dir]/config/spring/api/pubmed-integration.xml
Spring configuration file. These metadata mappings can be tweaked as desired. The format of this file is described in the "Metadata mapping" section above
These classes are simply implementations based of the base classes defined in importer/external. They add characteristic behavior for services/mapping for the PubMed specific data.