Skip to content

Commit

Permalink
migrate DIM2DataCite v4.5
Browse files Browse the repository at this point in the history
[Port dspace-7_x] Update of DataCite crosswalk to metadata schema 4.5

Co-authored-by: Tim Donohue <[email protected]>
  • Loading branch information
MajoBerger and tdonohue authored Apr 17, 2024
1 parent c8b899b commit 68379d4
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 44 deletions.
120 changes: 79 additions & 41 deletions dspace/config/crosswalks/DIM2DataCite.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@
<!--
Document : DIM2DataCite.xsl
Created on : January 23, 2013, 1:26 PM
Updated on : November 26, 2015, 3:00 PM
Author : pbecker, ffuerste
Updated on : Jaunary 30, 2024, 3:00 PM
Author : pbecker, ffuerste, ypaulsen
Description: Converts metadata from DSpace Intermediate Format (DIM) into
metadata following the DataCite Schema for the Publication and
Citation of Research Data, Version 3.1
metadata following the DataCite Metadata Schema 4.5
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dspace="http://www.dspace.org/xmlns/dspace/dim"
xmlns="http://datacite.org/schema/kernel-3"
xmlns="http://datacite.org/schema/kernel-4"
version="2.0">

<!-- CONFIGURATION -->
<!-- The parameters prefix, publisher, datamanager and hostinginstitution
moved to DSpace's configuration. They will be substituted automatically.
It is not necessary anymore to change this file.
Please take a look into the DSpace documentation for details on how to
change those. -->
<!-- DO NOT CHANGE ANYTHING BELOW THIS LINE EXCEPT YOU REALLY KNOW WHAT YOU ARE DOING! -->
<!-- This file handles the transformation of metadata into the DataCite
Schema. You should customize it to match your local metadata schema
and submission forms. Please note that this must produce valid XML
according to the DataCite Schema. Otherwise you will not be able
to register DOIs anymore. Please follow and reuse the examples
included in this file. For more information on the DataCite
Schema, see https://schema.datacite.org. -->

<!-- We need the prefix to determine DOIs that were minted by ourself. -->
<xsl:param name="prefix">10.5072/dspace-</xsl:param>
Expand All @@ -46,9 +50,9 @@
properties are in the metadata of the item to export.
The classe named above respects this.
-->
<resource xmlns="http://datacite.org/schema/kernel-3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
<resource xmlns="http://datacite.org/schema/kernel-4"
xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!--
MANDATORY PROPERTIES
Expand All @@ -65,7 +69,7 @@
company as well. We have to ensure to use URIs of our prefix
as primary identifiers only.
-->
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='identifier' and starts-with(., concat('http://dx.doi.org/', $prefix))]" />
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and (contains(., $prefix))]" />

<!--
DataCite (2)
Expand Down Expand Up @@ -219,7 +223,18 @@
Template call for ResourceType
DataCite allows the ResourceType to ouccre not more than once.
-->
<xsl:apply-templates select="(//dspace:field[@mdschema='dc' and @element='type'])[1]" />
<!--<xsl:apply-templates select="(//dspace:field[@mdschema='dc' and @element='type'])[1]" />-->
<xsl:choose>
<xsl:when test="(//dspace:field[@mdschema='dc' and @element='type'])[1]">
<xsl:apply-templates select="(//dspace:field[@mdschema='dc' and @element='type'])[1]" />
</xsl:when>
<xsl:otherwise>
<xsl:element name="resourceType">
<xsl:attribute name="resourceTypeGeneral">Other</xsl:attribute>
<xsl:value-of>Other</xsl:value-of>
</xsl:element>
</xsl:otherwise>
</xsl:choose>

<!--
DataCite (11)
Expand All @@ -230,14 +245,22 @@
Occ: 0-n
Required Attribute: alternateIdentifierType (free format)
-->
<xsl:if test="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and not(starts-with(., concat('http://dx.doi.org/', $prefix)))]">
<xsl:if test="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and not(contains(., $prefix))]">
<xsl:element name="alternateIdentifiers">
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and not(starts-with(., concat('http://dx.doi.org/', $prefix)))]" />
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and not(contains(., $prefix))]" />
</xsl:element>
</xsl:if>

<!--
DataCite (12)
Add relatedIdentifier.
DataCite requires a relatedIdentifierType, but we do not know which
type of identifier is part of the dc.relation.* fields within DSpace.
Skip the related identifier until we find a proper solution.
-->

<!--
DataCite (13)
Add sizes.
-->
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']">
Expand All @@ -246,7 +269,7 @@
</xsl:element>
</xsl:if>

<!-- DataCite (13)
<!-- DataCite (14)
Add formats.
-->
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format'][not(@qualifier='extent')]">
Expand All @@ -255,6 +278,13 @@
</xsl:element>
</xsl:if>

<!--
DataCite (15)
Add version.
As we currently do not link versions as related identifier, we skip
the version information too.
-->

<!--
DataCite (16)
Rights.
Expand Down Expand Up @@ -283,7 +313,15 @@
GeoLocation
DSpace currently doesn't store geolocations.
-->

<!--
DataCite (19)
FundingReference
DSpace currently doesn't store FundingReference.
-->
<!--
DataCite (20)
RelatedItem
-->
</resource>
</xsl:template>

Expand All @@ -295,9 +333,14 @@
company as well. We have to ensure to use URIs of our prefix
as primary identifiers only.
-->
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and starts-with(., concat('http://dx.doi.org/', $prefix))]">
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and (contains(., $prefix))]">
<identifier identifierType="DOI">
<xsl:value-of select="substring(., 19)"/>
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
<xsl:value-of select="substring(., 17)"/>
</xsl:if>
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
<xsl:value-of select="substring(., 19)"/>
</xsl:if>
</identifier>
</xsl:template>

Expand All @@ -313,16 +356,20 @@
<!-- DataCite (3) :: Title -->
<xsl:template match="dspace:field[@mdschema='dc' and @element='title']">
<xsl:element name="title">
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:if test="@qualifier='alternative'">
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:attribute name="titleType">AlternativeTitle</xsl:attribute>
</xsl:if>
<!-- DSpace does include niehter a dc.title.subtitle nor a
dc.title.translated. If necessary, please create those in the
metadata field registry. -->
<xsl:if test="@qualifier='subtitle'">
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:attribute name="titleType">Subtitle</xsl:attribute>
</xsl:if>
<xsl:if test="@qualifier='translated'">
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:attribute name="titleType">TranslatedTitle</xsl:attribute>
</xsl:if>
<xsl:value-of select="." />
Expand All @@ -341,6 +388,7 @@
-->
<xsl:template match="//dspace:field[@mdschema='dc' and @element='subject']">
<xsl:element name="subject">
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:if test="@qualifier">
<xsl:attribute name="subjectScheme"><xsl:value-of select="@qualifier" /></xsl:attribute>
</xsl:if>
Expand Down Expand Up @@ -436,7 +484,7 @@
dissertations. DataCite uses submitted for the "date the
creator submits the resource to the publisher". -->
<xsl:if test="@qualifier='submitted'">
<xsl:attribute name="dateType">Issued</xsl:attribute>
<xsl:attribute name="dateType">Submitted</xsl:attribute>
</xsl:if>
<xsl:if test="@qualifier='updated'">
<xsl:attribute name="dateType">Updated</xsl:attribute>
Expand Down Expand Up @@ -473,24 +521,24 @@
<xsl:attribute name="resourceTypeGeneral">
<xsl:choose>
<xsl:when test="string(text())='Animation'">Audiovisual</xsl:when>
<xsl:when test="string(text())='Article'">Text</xsl:when>
<xsl:when test="string(text())='Book'">Text</xsl:when>
<xsl:when test="string(text())='Book chapter'">Text</xsl:when>
<xsl:when test="string(text())='Article'">JournalArticle</xsl:when>
<xsl:when test="string(text())='Book'">Book</xsl:when>
<xsl:when test="string(text())='Book chapter'">BookChapter</xsl:when>
<xsl:when test="string(text())='Dataset'">Dataset</xsl:when>
<xsl:when test="string(text())='Learning Object'">InteractiveResource</xsl:when>
<xsl:when test="string(text())='Image'">Image</xsl:when>
<xsl:when test="string(text())='Image, 3-D'">Image</xsl:when>
<xsl:when test="string(text())='Map'">Model</xsl:when>
<xsl:when test="string(text())='Musical Score'">Other</xsl:when>
<xsl:when test="string(text())='Plan or blueprint'">Model</xsl:when>
<xsl:when test="string(text())='Preprint'">Text</xsl:when>
<xsl:when test="string(text())='Presentation'">Text</xsl:when>
<xsl:when test="string(text())='Preprint'">Preprint</xsl:when>
<xsl:when test="string(text())='Presentation'">Other</xsl:when>
<xsl:when test="string(text())='Recording, acoustical'">Sound</xsl:when>
<xsl:when test="string(text())='Recording, musical'">Sound</xsl:when>
<xsl:when test="string(text())='Recording, oral'">Sound</xsl:when>
<xsl:when test="string(text())='Software'">Software</xsl:when>
<xsl:when test="string(text())='Technical Report'">Text</xsl:when>
<xsl:when test="string(text())='Thesis'">Text</xsl:when>
<xsl:when test="string(text())='Technical Report'">Report</xsl:when>
<xsl:when test="string(text())='Thesis'">Dissertation</xsl:when>
<xsl:when test="string(text())='Video'">Audiovisual</xsl:when>
<xsl:when test="string(text())='Working Paper'">Text</xsl:when>
<xsl:when test="string(text())='Other'">Other</xsl:when>
Expand All @@ -512,7 +560,7 @@
resolveUrlToHandle(context, altId) until one is recognized or all have
been tested.
-->
<xsl:template match="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and not(starts-with(., concat('http://dx.doi.org/', $prefix)))]">
<xsl:template match="//dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and not(contains(., $prefix))]">
<xsl:element name="alternateIdentifier">
<xsl:if test="@qualifier">
<xsl:attribute name="alternateIdentifierType"><xsl:value-of select="@qualifier" /></xsl:attribute>
Expand Down Expand Up @@ -561,20 +609,9 @@
Adds Rights information
-->
<xsl:template match="//dspace:field[@mdschema='dc' and @element='rights']">
<xsl:choose>
<xsl:when test="@qualifier='uri'">
<xsl:element name="rights">
<xsl:attribute name="rightsURI">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="rights">
<xsl:value-of select="." />
</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="rights">
<xsl:value-of select="." />
</xsl:element>
</xsl:template>

<!--
Expand All @@ -583,6 +620,7 @@
-->
<xsl:template match="//dspace:field[@mdschema='dc' and @element='description' and (@qualifier='abstract' or @qualifier='tableofcontents' or not(@qualifier))]">
<xsl:element name="description">
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:attribute name="descriptionType">
<xsl:choose>
<xsl:when test="@qualifier='abstract'">Abstract</xsl:when>
Expand Down
6 changes: 3 additions & 3 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,13 @@ crosswalk.dissemination.DataCite.stylesheet = crosswalks/DIM2DataCite.xsl
## For DataCite via EZID, comment above and uncomment this:
#crosswalk.dissemination.DataCite.stylesheet = crosswalks/DIM2EZID.xsl
crosswalk.dissemination.DataCite.schemaLocation = \
http://datacite.org/schema/kernel-3 \
http://schema.datacite.org/meta/kernel-3/metadata.xsd
http://datacite.org/schema/kernel-4 \
http://schema.datacite.org/meta/kernel-4/metadata.xsd
crosswalk.dissemination.DataCite.preferList = false
crosswalk.dissemination.DataCite.publisher = My University
#crosswalk.dissemination.DataCite.dataManager = # defaults to publisher
#crosswalk.dissemination.DataCite.hostingInstitution = # defaults to publisher
crosswalk.dissemination.DataCite.namespace = http://datacite.org/schema/kernel-3
crosswalk.dissemination.DataCite.namespace = http://datacite.org/schema/kernel-4

# Crosswalk Plugin Configuration:
# The purpose of Crosswalks is to translate an external metadata format to/from
Expand Down

0 comments on commit 68379d4

Please sign in to comment.