Skip to content

Commit

Permalink
Merge pull request #136 from MaRDI4NFDI/openAire-Articles-Fixes
Browse files Browse the repository at this point in the history
Open aire articles fixes for many properties
  • Loading branch information
Mazztok45 authored Dec 16, 2024
2 parents 6ae6913 + 02e679f commit 38d5e17
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 37 deletions.
15 changes: 6 additions & 9 deletions test/data/articles/reference-OpenAire2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
xsi:schemaLocation="http://namespace.openaire.eu/schema/oaire/ https://www.openaire.eu/schema/repo-lit/4.0/openaire.xsd">
<datacite:identifier IdentifierType="URL">https://zbmath.org/6383667</datacite:identifier>
<datacite:alternateIdentifiers>
<datacite:alternateIdentifier alternateIdentifierType="URL">https://zbmath.org/1306.11073</datacite:alternateIdentifier>
<datacite:alternateIdentifier alternateIdentifierType="zbMATH Document ID">Zbl 6383667</datacite:alternateIdentifier>
<datacite:alternateIdentifier alternateIdentifierType="DOI">10.4007/annals.2015.181.1.7</datacite:alternateIdentifier>
</datacite:alternateIdentifiers>
<datacite:creators>
Expand Down Expand Up @@ -54,27 +52,26 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<datacite:date dateType="Available">2015</datacite:date>
</datacite:dates>
<dc:publisher>Princeton University, Mathematics Department, Princeton, NJ</dc:publisher>
<dc:language>Eng</dc:language>
<oaire:resourceType resourceTypeGeneral="literature" uri="http://purl.org/coar/resource_type/c_6501">journal article</oaire:resourceType>
<datacite:relatedIdentifiers>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="JournalArticle">10.2307/1971450</datacite:relatedIdentifier>
resourceTypeGeneral="Other">10.2307/1971450</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="JournalArticle">10.1112/plms/pdn046</datacite:relatedIdentifier>
resourceTypeGeneral="Other">10.1112/plms/pdn046</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="JournalArticle">10.7169/facm/1229442618</datacite:relatedIdentifier>
resourceTypeGeneral="Other">10.7169/facm/1229442618</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="JournalArticle">10.4007/annals.2009.170.819</datacite:relatedIdentifier>
resourceTypeGeneral="Other">10.4007/annals.2009.170.819</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="JournalArticle">10.1112/plms/pdm010</datacite:relatedIdentifier>
resourceTypeGeneral="Other">10.1112/plms/pdm010</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI"
relationType="Cites"
resourceTypeGeneral="JournalArticle">10.4007/annals.2014.179.3.7</datacite:relatedIdentifier>
resourceTypeGeneral="Other">10.4007/annals.2014.179.3.7</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/3377327</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/6587992</datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="IsCitedBy">https://zbmath.org/195021</datacite:relatedIdentifier>
Expand Down
41 changes: 13 additions & 28 deletions xslt/articles/xslt-article-OpenAire2.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<xsl:apply-templates select="root/zbmath_url"/>

<datacite:alternateIdentifiers>
<xsl:apply-templates select="root/identifier"/>
<xsl:apply-templates select="root/id"/>
<xsl:apply-templates select="root/links"/>
</datacite:alternateIdentifiers>
<datacite:creators>
Expand Down Expand Up @@ -50,7 +48,6 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
<xsl:apply-templates select="root/year"/>
</datacite:dates>
<xsl:apply-templates select="root/source/series/publisher"/>
<xsl:apply-templates select="root/language/languages"/>
<xsl:apply-templates select="root/document_type/description"/>
<datacite:relatedIdentifiers>

Expand All @@ -72,18 +69,6 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</datacite:identifier>
</xsl:template>

<xsl:template match="identifier">
<datacite:alternateIdentifier alternateIdentifierType="URL">
<xsl:text>https://zbmath.org/</xsl:text>
<xsl:value-of select="."/>
</datacite:alternateIdentifier>
</xsl:template>
<xsl:template match="id">
<datacite:alternateIdentifier alternateIdentifierType="zbMATH Document ID">
<xsl:value-of select="."/>
</datacite:alternateIdentifier>
</xsl:template>

<xsl:template match="root/links">
<xsl:choose>
<!-- Process the first 'links' node that has a 'doi' identifier -->
Expand All @@ -94,7 +79,7 @@ Content generated by zbMATH Open, such as reviews, classifications, software, or
</xsl:when>
<!-- If no 'doi' identifier is present, consider 'arxiv' -->
<xsl:when test="self::links[type = 'arxiv' and normalize-space(identifier) != ''][1] and not(preceding-sibling::links[type = 'doi' and normalize-space(identifier) != ''])">
<datacite:alternateIdentifier alternateIdentifierType="ARXIV">
<datacite:alternateIdentifier alternateIdentifierType="arXiv">
<xsl:value-of select="identifier"/>
</datacite:alternateIdentifier>
</xsl:when>
Expand Down Expand Up @@ -153,23 +138,23 @@ with its own subjectscheme -->
</datacite:subject>
</xsl:template>

<xsl:template match="datestamp">
<datacite:date dateType="Issued">
<!-- Extract just the date part (YYYY-MM-DD) from the datestamp -->
<xsl:value-of select="substring-before(. , 'T')" />
</datacite:date>
</xsl:template>
<xsl:template match="datestamp">
<!-- Check if the year part does not start with '0' -->
<xsl:if test="not(starts-with(substring(., 1, 4), '0'))">
<datacite:date dateType="Issued">
<!-- Extract just the date part (YYYY-MM-DD) from the datestamp -->
<xsl:value-of select="substring-before(., 'T')" />
</datacite:date>
</xsl:if>
</xsl:template>


<xsl:template match="year">
<datacite:date dateType="Available">
<xsl:value-of select="."/>
</datacite:date>
</xsl:template>
<xsl:template match="languages">
<dc:language>
<xsl:value-of select="substring-before(. , 'l')" />
</dc:language>
</xsl:template>

<xsl:template match="publisher">
<dc:publisher>
<xsl:value-of select="."/>
Expand All @@ -195,7 +180,7 @@ with its own subjectscheme -->
</oaire:resourceType>
</xsl:template>
<xsl:template match="doi[normalize-space()]">
<datacite:relatedIdentifier relatedIdentifierType="DOI" relationType="Cites" resourceTypeGeneral="JournalArticle"><xsl:value-of select="normalize-space(.)"/></datacite:relatedIdentifier>
<datacite:relatedIdentifier relatedIdentifierType="DOI" relationType="Cites" resourceTypeGeneral="Other"><xsl:value-of select="normalize-space(.)"/></datacite:relatedIdentifier>
</xsl:template>

<!-- Template to handle references with empty DOI elements and take the value of document_id also adding the url of zbmath to the result -->
Expand Down

0 comments on commit 38d5e17

Please sign in to comment.