forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
121978: Add ORCID IDs to OAI records
- Loading branch information
1 parent
5a43e6b
commit 048b38f
Showing
4 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
dspace-oai/src/test/java/org/dspace/xoai/tests/stylesheets/OpenAireXslTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* The contents of this file are subject to the license and copyright | ||
* detailed in the LICENSE and NOTICE files at the root of the source | ||
* tree and available online at | ||
* | ||
* http://www.dspace.org/license/ | ||
*/ | ||
package org.dspace.xoai.tests.stylesheets; | ||
|
||
import static org.dspace.xoai.tests.support.XmlMatcherBuilder.xml; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.containsString; | ||
|
||
import org.dspace.xoai.tests.support.XmlMatcherBuilder; | ||
import org.junit.Test; | ||
|
||
public class OpenAireXslTest extends AbstractXSLTest { | ||
|
||
@Test | ||
public void openAireCanTransformOrcidAuthors() throws Exception { | ||
String result = apply("oai_openaire.xsl").to(resource("xoai-test2.xml")); | ||
|
||
// match title | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:titles/datacite:title", | ||
containsString("Test Item"))); | ||
|
||
// match authors | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[1]/datacite:creatorName", | ||
containsString("PlainText, One"))); | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[2]/datacite:creatorName", | ||
containsString("Smith, John"))); | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[3]/datacite:creatorName", | ||
containsString("Doe, Jane"))); | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[4]/datacite:creatorName", | ||
containsString("PlainText, Two"))); | ||
|
||
// match ORCID IDs | ||
// first author shouldn't have an ORCID ID | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[1]/datacite:nameIdentifier" + | ||
"[@schemeURI='http://orcid.org']", containsString(""))); | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[2]/datacite:nameIdentifier" + | ||
"[@schemeURI='http://orcid.org']", containsString("0000-0000-0000-1234"))); | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[3]/datacite:nameIdentifier" + | ||
"[@schemeURI='http://orcid.org']", containsString("0000-0000-0000-5678"))); | ||
// final author shouldn't have an ORCID ID | ||
assertThat(result, openAire().withXPath( | ||
"/oaire:resource/datacite:creators/datacite:creator[1]/datacite:nameIdentifier" + | ||
"[@schemeURI='http://orcid.org']", containsString(""))); | ||
|
||
} | ||
|
||
private XmlMatcherBuilder openAire() { | ||
return xml().withNamespace("oaire", "http://namespace.openaire.eu/schema/oaire/") | ||
.withNamespace("datacite", "http://datacite.org/schema/kernel-4") | ||
.withNamespace("dc", "http://purl.org/dc/elements/1.1/") | ||
.withNamespace("doc", "http://www.lyncode.com/xoai") | ||
.withNamespace("rdf", "http://www.w3.org/TR/rdf-concepts/") | ||
.withNamespace("vc", "http://www.w3.org/2007/XMLSchema-versioning") | ||
.withNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
The contents of this file are subject to the license and copyright | ||
detailed in the LICENSE and NOTICE files at the root of the source | ||
tree and available online at | ||
http://www.dspace.org/license/ | ||
--> | ||
<metadata xmlns="http://www.lyncode.com/xoai" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.lyncode.com/xoai http://www.lyncode.com/xsd/xoai.xsd"> | ||
<element name="dc"> | ||
<element name="contributor"> | ||
<element name="author"> | ||
<element name="none"> | ||
<field name="value">PlainText, One</field> | ||
<field name="authority">e069e116-6ed5-40dd-85da-8a7d3e30d663</field> | ||
<field name="confidence">-1</field> | ||
<field name="value">Smith, John</field> | ||
<field name="authority">376bbd13-dac5-4a32-9d35-70742e3f84c5</field> | ||
<field name="confidence">600</field> | ||
<field name="orcid_id">0000-0000-0000-1234</field> | ||
<field name="value">Doe, Jane</field> | ||
<field name="authority">102616ab-95dd-4974-af1a-8f587c61eed1</field> | ||
<field name="confidence">600</field> | ||
<field name="orcid_id">0000-0000-0000-5678</field> | ||
<field name="value">PlainText, Two</field> | ||
<field name="authority">a485dbe7-c5de-470f-ae33-ca166e6cdbae</field> | ||
<field name="confidence">-1</field> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="date"> | ||
<element name="accessioned"> | ||
<element name="none"> | ||
<field name="value">2024-12-29</field> | ||
</element> | ||
</element> | ||
<element name="available"> | ||
<element name="none"> | ||
<field name="value">2024-12-31</field> | ||
</element> | ||
</element> | ||
<element name="issued"> | ||
<element name="none"> | ||
<field name="value">2024-12-30</field> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="identifier"> | ||
<element name="uri"> | ||
<element name="none"> | ||
<field name="value">http://localhost:4000/handle/123456789/5</field> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="description"> | ||
<element name="abstract"> | ||
<element name="none"> | ||
<field name="value">This is a test item.</field> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="title"> | ||
<element name="none"> | ||
<field name="value">Test Item</field> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="bundles"> | ||
<element name="bundle"> | ||
<field name="name">ORIGINAL</field> | ||
<element name="bitstreams"> | ||
<element name="bitstream"> | ||
<field name="name">test.pdf</field> | ||
<field name="originalName">test.pdf</field> | ||
<field name="format">application/pdf</field> | ||
<field name="size">28425</field> | ||
<field name="url">http://localhost:4000/bitstreams/0e26b0db-1714-48e5-9ac0-77499ebe5cd8/download | ||
</field> | ||
<field name="checksum">0cf16e811f0070cd46ba2e43ca956a3d</field> | ||
<field name="checksumAlgorithm">MD5</field> | ||
<field name="sid">1</field> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="bundle"> | ||
<field name="name">LICENSE</field> | ||
<element name="bitstreams"> | ||
<element name="bitstream"> | ||
<field name="name">license.txt</field> | ||
<field name="originalName">license.txt</field> | ||
<field name="format">text/plain; charset=utf-8</field> | ||
<field name="size">1748</field> | ||
<field name="url">http://localhost:4000/bitstreams/fc78f4c5-350f-434a-8aa5-a89477994e73/download | ||
</field> | ||
<field name="checksum">8a4605be74aa9ea9d79846c1fba20a33</field> | ||
<field name="checksumAlgorithm">MD5</field> | ||
<field name="sid">1</field> | ||
</element> | ||
</element> | ||
</element> | ||
</element> | ||
<element name="others"> | ||
<field name="handle">123456789/5</field> | ||
<field name="identifier">oai:localhost:123456789/5</field> | ||
<field name="lastModifyDate">2024-12-31 14:35:41.465</field> | ||
<element name="access-status"> | ||
<field name="value">open.access</field> | ||
</element> | ||
</element> | ||
<element name="repository"> | ||
<field name="url">http://localhost:4000</field> | ||
<field name="name">DSpace at My University</field> | ||
<field name="mail">[email protected]</field> | ||
</element> | ||
<element name="license"> | ||
<field name="bin"> | ||
Tk9URTogUExBQ0UgWU9VUiBPV04gTElDRU5TRSBIRVJFClRoaXMgc2FtcGxlIGxpY2Vuc2UgaXMgcHJvdmlkZWQgZm9yIGluZm9ybWF0aW9uYWwgcHVycG9zZXMgb25seS4KCk5PTi1FWENMVVNJVkUgRElTVFJJQlVUSU9OI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d2VkIGJ5IHRoaXMKbGljZW5zZSwgdG8geW91ciBzdWJtaXNzaW9uLgo= | ||
</field> | ||
</element> | ||
</metadata> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters