Commit aead395b authored by Gerrit Hübbers's avatar Gerrit Hübbers 🃏
Browse files

Finalize Interculture metadata transformation rules

parent 96a22ca5
......@@ -382,34 +382,8 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Convivialism") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "Cosmopolitanism") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "de", "Konvivialismus; Interkulturalismus; Kosmopolitismus; interkulturelle Kommunikation; positivistische Forschungsmethoden") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "Vietnam: Economic Strategy and Economic Reality") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Fforde, Adam") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.journal", "Journal of Current Southeast Asian Affairs") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "35") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "2") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "The paper examines the nature of the growing Vietnamese economy and its changing structural characteristics and contrasts this with two core elements of official thinking. The first element is the slogan of ‘industrialisation and modernisation’ (IM) and how this sits with the rather fast current growth in the services sectors, given the issues of transitioning through the recently reached ‘middle income status’. The second is that of “a socialist-oriented market economy” (SOME) with reference to its origins, the nature of debates around it and its positive and negative implications for Vietnam’s development. Our basic conclusions are that IM is misplaced, as it ignores services and is out-of-date, and the SOME has largely been a somewhat confused and transparent fig-leaf for support for essentially private commercial interests associated with certain state conglomerates. Recent changes around the 2016 XIIth Congress suggest that lessons are being learned by some elements in the Party.") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "Political Science; International Relations") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "Vietnam; economic growth; politics; political economy; industrialisation; development policy") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "1868-4882") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.urn", "urn:nbn:de:gbv:18-4-9527") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.uri", "https://journals.sub.uni-hamburg.de/giga/jsaa/article/download/952/959") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://journals.sub.uni-hamburg.de/giga/jsaa/article/view/952") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.stock", "article") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.document", "32") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "27") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.date.issued", "2016") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "300") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "320") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "324") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "330") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "335") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "30 Years Doi Moi") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "Rethinking Interculturality Will Require Moral Confessions: Analysing the Debate Among Convivialists, Interculturalists, Cosmopolitanists and Intercultural Communication Scholars") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title.alternative", "de", "Interkulturalität neu denken erfordert moralische Bekenntnisse. Die Analyse einer Debatte zwischen Vertreter*innen von Konvivialismus, Interkulturalismus, Kosmopolitismus sowie Autor*innen zur interkulturellen Kommunikation") ) );
}
@Test
......
......@@ -215,7 +215,6 @@
<xsl:template match="nlm:kwd">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage(../@xml:lang)" />
<xsl:variable name="subjects" select="replace( text(), ',', ';')" />
<xsl:message terminate="no">here is some message for stderr2, e.g. <xsl:value-of select='text()' /> </xsl:message>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.other'"/>
<xsl:with-param name="language" select="$sanitizedLanguage"/>
......@@ -223,64 +222,7 @@
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:title">
<xsl:variable name="publicationLanguage" select="/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/xMetaDiss:xMetaDiss/dc:language[@xsi:type='dcterms:ISO639-2']" />
<xsl:variable name="language" select="@lang" />
<!-- <xsl:message terminate="no">language is <xsl:value-of select='$language' /> ... and publicationLanguage is <xsl:value-of select='$publicationLanguage' /> </xsl:message> -->
<!-- dc.title and dc.title.alternative may exist. Iff dc.language equals some source-dc.title, then this is the result-dc.title ... otherwise (iff they don't equal) it is taken as dc.title.alternative -->
<xsl:choose>
<xsl:when test="$language = $publicationLanguage">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'"/>
<xsl:with-param name="language" select="$language"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title.alternative'"/>
<xsl:with-param name="language" select="$language"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="dc:subject[@xsi:type='dcterms:DDC']">
<!-- e.g., here text() evaluates to '300, 303, 320, 324' -->
<xsl:for-each select="tokenize(text(), '; ')" >
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="normalize-space(.)"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template match="dc:subject[@xsi:type='xMetaDiss:noScheme']">
<!-- querying for metadataPrefix=oai_dc provides language keys -->
<!-- replacing commas with semicolons -->
<xsl:variable name="subjects" select="replace( text(), ',', ';')" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.other'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$subjects"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="/oai:OAI-PMH/oai:GetRecord/oai:record/oai:header/oai:setSpec">
<!-- the following rules are based on https://journals.sub.uni-hamburg.de/giga/afsp/about/editorialPolicies#peerReviewProcess -->
<xsl:choose>
<xsl:when test="text() = 'icj:AT'">
<xsl:call-template name="new-metadatum">
......@@ -330,7 +272,7 @@
<xsl:when test="$inputLanguage = 'ger' or $inputLanguage = 'DE' or $inputLanguage = 'de-DE'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US'">
<xsl:when test="$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US' or $inputLanguage = 'en-GB'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:otherwise>
......
......@@ -65,6 +65,29 @@
</xsl:if>
</xsl:template>
<xsl:template match="dc:title">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage( @xml:lang )" />
<xsl:variable name="sanitizedMainLanguage" select="zoai:sanitizeLanguage( /oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:language )" />
<xsl:choose>
<xsl:when test="$sanitizedLanguage = $sanitizedMainLanguage">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'"/>
<xsl:with-param name="language" select="$sanitizedLanguage"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title.alternative'"/>
<xsl:with-param name="language" select="$sanitizedLanguage"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="new-metadatum">
<xsl:param name="key" />
......@@ -94,10 +117,10 @@
<xsl:function name="zoai:sanitizeLanguage">
<xsl:param name="inputLanguage" />
<xsl:choose>
<xsl:when test="$inputLanguage = 'ger'">
<xsl:when test="$inputLanguage = 'ger' or $inputLanguage = 'DE' or $inputLanguage = 'de-DE'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'eng'">
<xsl:when test="$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US' or $inputLanguage = 'en-GB'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:otherwise>
......
Supports Markdown
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