Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

OAI 2.0 could also work using the database for querying. To configure that one must change the[dspace]/conf

Table of Contents
minLevel2
outlinetrue
stylenone

...

OAI 2.0 is a separate webapp which is a complete substitute for the old "oai" webapp. OAI 2.0 has a configurable data source, by default it will not query the DSpace SQL database at the time of the OAI-PMH request. Instead, it keeps the required metadata in its Solr index (currently in a separate "oai" Solr core) and serves it from there. It's also possible to set OAI 2.0 to only use the database for querying purposes if necessary, but this decreases performance significantly. Furthermore, it the webapp caches the requests, so doing the same query repeatedly is very fast. In addition to that it also compiles DSpace items to make uncached responses much faster.

...

And at /openaire context it provides:

  1. OAI_DC
  2. METS

Configuration

Basic Configuration

Configuration File:

[dspace]/config/modules/oai.cfg

Property:

storage

Example Value:

storage = solr

Information Note:

This allows to choose the OAI data source between solr and database

Property:

solr.url

Example Value:

solr.url = ${default.solr.server}/oai

Informational Note:

Solr Server location

Property:

identifier.prefix

Example Value:

identifier.prefix = ${dspace.hostname}

Informational Note:

OAI persistent identifier prefix. Format - oai:PREFIX:HANDLE

Property:

config.dir

Example Value:

config.dir = ${dspace.dir}/config/crosswalks/oai

Informational Note:

Configuration directory, used by XOAI (core library). Contains xoai.xml, metadata format XSLTs and transformer XSLTs.

Property:

cache.dir

Example Value:

cache.dir = ${dspace.dir}/var/oai

Informational Note:

Directory to store runtime generated files (for caching purposes).

Advanced Configuration

OAI 2.0 allows you to configure following advanced options:

  • Contexts
  • Transformers
  • Metadata Formats
  • Filters
  • Sets

It's an XML file commonly located at: [dspace]/config/crosswalks/oai/xoai.xml

General options

These options influence the OAI interface globally. "per page" means per request, next page (if there is one) can be requested using resumptionToken provided in current page.

  • identation [boolean] - whether the output XML should be indented to make it human-readable

  • maxListIdentifiersSize [integer] - how many identifiers to show per page (verb=ListIdentifiers)

  • maxListRecordsSize [integer] - how many records to show per page (verb=ListRecords)
  • maxListSetsSize [integer] - how many sets to show per page (verb=ListSets)

  • stylesheet [relative file path] - an xsl stylesheet used by client's web browser to transform the output XML into human-readable HTML

Their location and default values are shown in the following fragment:

Code Block
<Configuration xmlns="http://www.lyncode.com/XOAIConfiguration"
	identation="false"
	maxListIdentifiersSize="100"
	maxListRecordsSize="100"
	maxListSetsSize="100"
	stylesheet="static/style.xsl">

Add/Remove Metadata Formats

Each context could have its own metadata formats. So to add/remove metadata formats to/from it, just need add/remove its reference within xoai.xml, for example, imagine one need to remove the XOAI schema from:

Code Block
<Context baseurl="request">
  <Format refid="oaidc" />
  <Format refid="mets" />
  <Format refid="xoai" />
  <Format refid="didl" />
  <Format refid="dim" />
  <Format refid="ore" />
  <Format refid="rdf" />
  <Format refid="etdms" />
  <Format refid="mods" />
  <Format refid="qdc" />
  <Format refid="marc" />
  <Format refid="uketd_dc" />
</Context>

Encoding problems

There are two main potential sources of encoding problems:

a) The servlet connector port has to use the correct encoding. E.g. for Tomcat, this would be <Connector port="8080" ... URIEncoding="UTF-8" />, where the port attribute specifies port of the connector that DSpace is configured to access Solr on (this is usually 8080, 80 or in case of AJP 8009).

b) System locale of the dspace command line script that is used to do the oai import. Make sure the user account launching the script (usually from cron) has the correct locale set (e.g. en_US.UTF-8). Also make sure the locale is actually present on your system.

Configuration

Basic Configuration

Configuration File:

[dspace]/config/modules/oai.cfg

Property:

storage

Example Value:

storage = solr

Information Note:

This allows to choose the OAI data source between solr and database

Property:

solr.url

Example Value:

solr.url = ${default.solr.server}/oai

Informational Note:

Solr Server location

Property:

identifier.prefix

Example Value:

identifier.prefix = ${dspace.hostname}

Informational Note:

OAI persistent identifier prefix. Format - oai:PREFIX:HANDLE

Property:

config.dir

Example Value:

config.dir = ${dspace.dir}/config/crosswalks/oai

Informational Note:

Configuration directory, used by XOAI (core library). Contains xoai.xml, metadata format XSLTs and transformer XSLTs.

Property:

cache.dir

Example Value:

cache.dir = ${dspace.dir}/var/oai

Informational Note:

Directory to store runtime generated files (for caching purposes).

Advanced Configuration

OAI 2.0 allows you to configure following advanced options:

  • Contexts
  • Transformers
  • Metadata Formats
  • Filters
  • Sets

It's an XML file commonly located at: [dspace]/config/crosswalks/oai/xoai.xml

General options

These options influence the OAI interface globally. "per page" means per request, next page (if there is one) can be requested using resumptionToken provided in current page.

  • identation [boolean] - whether the output XML should be indented to make it human-readable

  • maxListIdentifiersSize [integer] - how many identifiers to show per page (verb=ListIdentifiers)

  • maxListRecordsSize [integer] - how many records to show per page (verb=ListRecords)
  • maxListSetsSize [integer] - how many sets to show per page (verb=ListSets)

  • stylesheet [relative file path] - an xsl stylesheet used by client's web browser to transform the output XML into human-readable HTML

Their location and default values are shown in the following fragment:

Code Block
<Configuration xmlns="http://www.lyncode.com/XOAIConfiguration"
	identation="false"
	maxListIdentifiersSize="100"
	maxListRecordsSize="100"
	maxListSetsSize="100"
	stylesheet="static/style.xsl">

Add/Remove Metadata Formats

Each context could have its own metadata formats. So to add/remove metadata formats to/from it, just need add/remove its reference within xoai.xml, for example, imagine one need to remove the XOAI schema fromThen one would have:

Code Block
<Context baseurl="request">
  <Format refid="oaidc" />
  <Format refid="mets" />
  <Format refid="xoai" />
  <Format refid="didl" />
  <Format refid="dim" />
  <Format refid="ore" />
  <Format refid="rdf" />
  <Format refid="etdms" />
  <Format refid="mods" />
  <Format refid="qdc" />
  <Format refid="marc" />
  <Format refid="uketd_dc" />
</Context>

It is also possible to create new metadata format by creating a specific XSLT for it. All already defined XSLT for DSpace can be found in the [dspace]/config/crosswalks/oai/metadataFormats directory. So after producing a new one, add the following information (location marked using brackets) inside the <Formats> element in [dspace]/config/crosswalks/oai/xoai.xml:

Code Block
<Format id="[IDENTIFIER]">
  <Prefix>[PREFIX]</Prefix>
  <XSLT>metadataFormats/[XSLT]</XSLT>
  <Namespace>[NAMESPACE]</Namespace>
  <SchemaLocation>[SCHEMA_LOCATION]</SchemaLocation>
</Format>

where:

Parameter

Description

IDENTIFIER

The identifier used within context configurations to reference this specific format, must be unique within all Metadata Formats available.

PREFIX

The prefix used in OAI interface (metadataPrefix=PREFIX).

XSLT

The name of the XSLT file within [dspace]/config/crosswalks/oai/metadataFormats directory

NAMESPACE

XML Default Namespace of the created Schema

SCHEMA_LOCATION

URI Location of the XSD of the created Schema

Then one would have:

Code Block
<Context baseurl="request">
  <Format refid="oaidc" />
  <Format refid="mets" />
  <Format refid="didl" />
  <Format refid="dim" />
  <Format refid="ore" />
  <Format refid="rdf" />
  <Format refid="etdms" />
  <Format refid="mods" />
  <Format refid="qdc" />
  <Format refid="marc" />
  <Format refid="uketd_dc" />
</Context>

It is also possible to create new metadata format by creating a specific XSLT for it. All already defined XSLT for DSpace can be found in the [dspace]/config/crosswalks/oai/metadataFormats directory. So after producing a new one, add the following information (location marked using brackets) inside the <Formats> element in [dspace]/config/crosswalks/oai/xoai.xml:

Code Block
<Format id="[IDENTIFIER]">
  <Prefix>[PREFIX]</Prefix>
  <XSLT>metadataFormats/[XSLT]</XSLT>
  <Namespace>[NAMESPACE]</Namespace>
  <SchemaLocation>[SCHEMA_LOCATION]</SchemaLocation>
</Format>

where:

Parameter

Description

IDENTIFIER

The identifier used within context configurations to reference this specific format, must be unique within all Metadata Formats available.

PREFIX

The prefix used in OAI interface (metadataPrefix=PREFIX).

XSLT

The name of the XSLT file within [dspace]/config/crosswalks/oai/metadataFormats directory

NAMESPACE

XML Default Namespace of the created Schema

SCHEMA_LOCATION

URI Location of the XSD of the created Schema

NOTE: Changes in [dspace]/config/crosswalks/oai/xoai.xml requires reloading/restarting the servlet container.

Add/Remove Metadata Fields

The internal DSpace fields (Dublin Core) are exposed in the internal XOAI format (xml). All other metadata formats exposed via OAI are mapped from this XOAI format using XSLT (xoai.xsl itself is just an identity transformation). These XSLT stylesheets are found in the [dspace]/config/crosswalks/oai/metadataFormats directory. So e.g. oai_dc.xsl is a transformation from the XOAI format to the oai_dc format (unqualified Dublin Core).

Therefore exposing any DSpace metadata field in any OAI format is just a matter of modifying the corresponding output format stylesheet (This assumes the general knowledge of how XSLT works. For a tutorial, see e.g. http://www.w3schools.com/xsl/).

For example, if you have a DC field "local.note.librarian" that you want to expose in oai_dc as <dc:note> (please note that this is not a valid DC field and thus breaks compatibility), then edit oai_dc.xsl and add the following lines just above the closing tag </oai_dc:dc>:

Code Block
languagexml
<xsl:for-each select="doc:metadata/doc:element[@name='local']/doc:element[@name='note']/doc:element/doc:element/doc:field[@name='librarian']">
    <dc:note><xsl:value-of select="." /></dc:note>
</xsl:for-each>

If you need to add/remove metadata fields, you're changing the output format. Therefore it is recommended to create a new metadata format as a copy of the one you want to modify. This way the old format will remain available along with the new one and any upgrades to the original format during DSpace upgrades will not overwrite your customizations. If you need the format to have the same name as the original format (e.g. the default oai_dc format), you can create a new context in xoai.xsl containing your modified format with the original name, which will be available as /oai/context-name.

NOTE: Please, keep in mind that the OAI provider caches the transformed output, so you have to run [dspace]/bin/dspace oai clean-cache after any .xsl modification and reload the OAI page for the changes to take effect. When adding/removing metadata formats, making changes NOTE: Changes in [dspace]/config/crosswalks/oai/xoai.xml requires reloading/restarting the servlet container.

...