Commit 6dd78548 authored by Steinberg, Jan's avatar Steinberg, Jan

exeley specialties and test

parent 58bd1ded
......@@ -238,9 +238,9 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
getClass().
getClassLoader().
getResourceAsStream("xslt/exeley-pam-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
map.put("pam", oaiDcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("http://www.exeley.com/oai/", map);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("http://www.exeley.com/oai/OAIRequest", map);
Bundle bundle = bss.getBundle("oai:exeley.com:10.21307/joss-2018-001");
......@@ -249,7 +249,7 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.stock", "article") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.document", "32") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.journal", "1439") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.journal", "1632") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Krishna, M.") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Bino Paul, G.D.") ) );
......@@ -265,7 +265,7 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "1") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.source.issue") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "32") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "OBEN_UNTEN : Bilder vom Leben der Anderen") ) );
// assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.source.issuetopic") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.pageinfo", "3-6") ) );
......@@ -274,21 +274,21 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.urn", "urn:nbn:de:gbv:18-8-7560") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.21307/joss-2018-001") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.dda.reference", "http://www.exeley.com/oai/@@oai:exeley.com:10.21307/joss-2018-001") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.dda.reference", "http://www.exeley.com/oai/OAIRequest@@oai:exeley.com:10.21307/joss-2018-001") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "USA") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.classoz", "10900") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classoz", "10900") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "300") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.ddc", "300") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.status", "formal und inhaltlich fertig erschlossen") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.other", "Collaboration") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.other", "Structure") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.other", "Networks") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.other", "Degree") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.other", "Indian economics") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Collaboration") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Structure") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Networks") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Degree") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Indian economics") ) );
Set<InputStream> fileSet = bundle.getContents();
assertEquals( 1, fileSet.size());
assertEquals( 2, fileSet.size());
}
@Test
......
......@@ -8,7 +8,7 @@
xmlns:zoai="http://git.gesis.org/dda/zoai"
>
<xsl:output indent="yes"/>
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- <xsl:message terminate="no">here is the tree at the current node <xsl:copy-of select="."/> </xsl:message> -->
<!-- <xsl:message terminate="no">here is some message for stderr, e.g. <xsl:value-of select='text()' /> </xsl:message> -->
......@@ -26,6 +26,7 @@
<xsl:element name="bundle">
<xsl:element name="metadata">
<xsl:variable name="ddaReference" select="concat(oai:OAI-PMH/oai:request[@verb='GetRecord']/text(), '@@', oai:OAI-PMH/oai:request[@verb='GetRecord']/@identifier)" />
<xsl:variable name="setSpec" select="/oai:OAI-PMH/oai:GetRecord/oai:record/oai:header/oai:setSpec/text()"/>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.dda.reference'"/>
<xsl:with-param name="language" select="''"/>
......@@ -44,17 +45,62 @@
<xsl:with-param name="value" select="'32'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.rights.licence'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'32'"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$setSpec = 'journal_of_social_structure'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.rights.licence'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'32'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.journal'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1632'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1529-1227'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$setSpec = 'journal_of_educational_leadership_policy_and_pract'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.rights.licence'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'20'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.journal'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1674'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1178-8704'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$setSpec = 'connections'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.rights.licence'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'16'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.journal'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1725'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1529-1227'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.journal'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1507'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.pubstatus'"/>
......@@ -80,6 +126,12 @@
<xsl:with-param name="value" select="'1'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.language'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'en'"/>
</xsl:call-template>
<!--xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
......@@ -92,12 +144,6 @@
<xsl:with-param name="value" select="'10900'"/>
</xsl:call-template-->
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1529-1227'"/>
</xsl:call-template>
<!--xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.ddc'"/>
<xsl:with-param name="language" select="''"/>
......@@ -123,6 +169,7 @@
<xsl:apply-templates select="dc:identifier"/>
<xsl:apply-templates select="dc:title"/>
<xsl:apply-templates select="dc:creator"/>
<xsl:apply-templates select="prism:keyword"/>
<xsl:apply-templates select="prism:publicationDate"/>
<xsl:apply-templates select="prism:volume"/>
<xsl:apply-templates select="prism:number"/>
......@@ -159,6 +206,30 @@
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="prism:keyword">
<xsl:if test="string-length(normalize-space(text())) > 0">
<xsl:choose>
<xsl:when test="contains(normalize-space(text()), ';')">
<xsl:for-each select="tokenize(normalize-space(text()), ';')">
<xsl:if test="string-length(normalize-space(.)) > 0">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.other'"/>
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="normalize-space(.)"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.other'"/>
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="normalize-space(text())"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="prism:publicationDate">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.date.issued'"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment