Skip to content

Commit

Permalink
support for dois and preregister pids
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondra Kosarko authored and kosarko committed Nov 8, 2023
1 parent cf19546 commit ac41833
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,11 @@ public void reserveDOI(Context context, DSpaceObject dso, String doi)
return;
}
// 400 -> invalid XML
case (422):
case (400): {
log.warn("DataCite was unable to understand the XML we send.");
log.warn("DataCite Metadata API returned a http status code "
+ "400: " + resp.getContent());
+ resp.getStatusCode() + ": " + resp.getContent());
Format format = Format.getCompactFormat();
format.setEncoding("UTF-8");
XMLOutputter xout = new XMLOutputter(format);
Expand Down
49 changes: 13 additions & 36 deletions dspace/config/crosswalks/DIM2DataCite.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-->
<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 -->
Expand Down Expand Up @@ -46,9 +46,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"
<resource xmlns="http://datacite.org/schema/kernel-4"
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">
xsi:schemaLocation="http://datacite.org/schema/kernel-4 https://schema.datacite.org/meta/kernel-4.4/metadata.xsd">

<!--
MANDATORY PROPERTIES
Expand Down Expand Up @@ -139,6 +139,13 @@
</xsl:choose>
</publicationYear>

<!--
DataCite (10)
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]" />

<!--
OPTIONAL PROPERTIES
-->
Expand Down Expand Up @@ -214,13 +221,6 @@
-->
<xsl:apply-templates select="(//dspace:field[@mdschema='dc' and @element='language' and (@qualifier='iso' or @qualifier='rfc3066')])[1]" />

<!--
DataCite (10)
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]" />

<!--
DataCite (11)
Add alternativeIdentifiers.
Expand Down Expand Up @@ -469,35 +469,12 @@
Adds resourceType and resourceTypeGeneral information
-->
<xsl:template match="//dspace:field[@mdschema='dc' and @element='type'][1]">
<xsl:variable name="types" select="tokenize(text(),';')"/>
<xsl:element name="resourceType">
<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())='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())='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())='Video'">Audiovisual</xsl:when>
<xsl:when test="string(text())='Working Paper'">Text</xsl:when>
<xsl:when test="string(text())='Other'">Other</xsl:when>
<xsl:otherwise>Other</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$types[1]"/>
</xsl:attribute>
<xsl:value-of select="." />
<xsl:value-of select="$types[2]" />
</xsl:element>
</xsl:template>

Expand Down
3 changes: 2 additions & 1 deletion dspace/config/item-submission.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
<step id="collection"/>
<!-- To include the 'Show Identifiers' step, uncomment the line below. Make sure
that identifiers.cfg and identifier-service.xml are properly configured. -->
<!--<step id="identifiers"/>-->
<step id="identifiers"/><!---->
<!--Step will be to Describe the item. -->
<step id="traditionalpageone"/>
<step id="traditionalpagetwo"/>
Expand All @@ -284,6 +284,7 @@

<submission-process name="datacite">
<step id="collection"></step>
<step id="identifiers"/><!---->
<step id="datacitemandatory"></step>
<step id="upload"/>
<step id="license"/>
Expand Down
6 changes: 3 additions & 3 deletions dspace/config/spring/api/identifier-service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
depending on whether you have Item Level Versioning activated or not.
-->
<!--
-->
<bean id="org.dspace.identifier.DOIIdentifierProvider"
class="org.dspace.identifier.DOIIdentifierProvider"
scope="singleton">
<property name="configurationService"
ref="org.dspace.services.ConfigurationService" />
<property name="DOIConnector"
ref="org.dspace.identifier.doi.DOIConnector" />
<property name="filter" ref="doi-filter" />
<!--<property name="filter" ref="doi-filter" />-->
</bean>
-->
<!--
<bean id="org.dspace.identifier.DOIIdentifierProvider"
class="org.dspace.identifier.VersionedDOIIdentifierProvider"
Expand Down Expand Up @@ -93,6 +93,7 @@
DataCiteConnector won't work if EZID is your registration agency.
-->
<!-- Uncomment this to use the DataCite API directly as DOIConnector.
-->
<bean id="org.dspace.identifier.doi.DOIConnector"
class="org.dspace.identifier.doi.DataCiteConnector"
scope="singleton">
Expand All @@ -102,7 +103,6 @@
<property name='DATACITE_METADATA_PATH' value='/metadata/' />
<property name='disseminationCrosswalkName' value="DataCite" />
</bean>
-->

<!-- Provider to mint and register DOIs using EZID as the registrar.
-->
Expand Down
13 changes: 13 additions & 0 deletions dspace/config/spring/api/item-filters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,19 @@
</bean>
<!-- Create DOIs for items only that do have at least one bitstream. -->
<ref bean="has-at-least-one-bitstream_condition"/>
<!--
<bean class="org.dspace.content.logic.condition.InCollectionCondition">
<property name="parameters">
<map>
<entry key="collections">
<list>
<value>123456789/4</value>
</list>
</entry>
</map>
</property>
</bean>
-->
</list>
</property>
</bean>
Expand Down

0 comments on commit ac41833

Please sign in to comment.