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

Improve ContentResolver for GIGA journals. Add GIGA harvester configuration

parent 9ed29c73
......@@ -319,7 +319,12 @@ public class ContentResolver {
if ( seedUrlString.contains("wbv.de") ) {
result = new WbvResolvingStrategy();
}
else if ( seedUrlString.contains("journals.sub.uni-hamburg.de") ) {
// unfortunately, SUB Uni Hamburg's OJS instances report an incorrect HTML citation_pdf_url
// meta element which points not to the actual PDF bitstream, but the landing page.
// Therefore, we discard all possible (X)HTML bitstream heuristics
result = new EmptySetResolvingStrategy();
}
else {
result = new CatchAllResolvingStrategy();
}
......
package org.gesis.dda.publishing.domain.impl;
import java.util.Set;
import org.gesis.dda.publishing.domain.ContentsUrlsResolvingStrategy;
import com.google.common.collect.ImmutableSet;
public class EmptySetResolvingStrategy implements ContentsUrlsResolvingStrategy {
@Override
public Set<String> getContentsUrls(String seedUrl) {
return ImmutableSet.of();
}
}
......@@ -16,6 +16,8 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
......@@ -550,6 +552,27 @@ public class ContentResolverTest {
assertTrue(isEqual);
}
@Test
public void findCorrectPdfFromSubUniHamburg() throws IOException {
Metadatum m1 = new SimpleMetadatum("dc.identifier.urn", "urn:nbn:de:gbv:18-4-10578");
Metadatum m2 = new SimpleMetadatum("dc.identifier.uri", "https://journals.sub.uni-hamburg.de/giga/jpla/article/download/1057/1064");
Metadatum m3 = new SimpleMetadatum("dc.identifier.url", "https://journals.sub.uni-hamburg.de/giga/jpla/article/view/1057");
Set<Metadatum> metadata = ImmutableSet.of(m1, m2, m3);
//Set<Metadatum> metadata = ImmutableSet.of(m1);
//Set<Metadatum> metadata = ImmutableSet.of(m1, m3);
Set<InputStreamAndFilenameSupplier> suppliers = ContentResolver.resolveContentsSuppliers(metadata);
suppliers.stream().map(supplier -> supplier.getFilename()).forEach(LOG::info);
List<InputStreamAndFilenameSupplier> list = new ArrayList<>(suppliers);
assertEquals(1, list.size() );
InputStreamAndFilenameSupplier supplier = list.get(0);
InputStream resolvedPdfInputStream = supplier.get();
InputStream originalPdfInputStream = getClass().getResourceAsStream("/1057-1095-1-PB.pdf");
boolean isEqual = IOUtils.contentEquals(originalPdfInputStream, resolvedPdfInputStream);
assertTrue(isEqual);
}
@Test
public void testWbvJsoup() throws IOException {
Document doc = Jsoup.connect(WBV_SEVERAL_IRRELEVANT_PDFS_METADATUM.getValue()).get();
......
......@@ -134,4 +134,130 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertTrue( metadata.stream().noneMatch( m -> m.getKey().equals("dc.source.pageinfo") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "political unrest; violence; elections/voting; ethnic conflicts; comparative analysis") ) ); // test for replacing commas with semicolons
}
@Test
public void getSinglePublicationJcca() throws IOException {
Map<String, String> map = new HashMap<>();
String xMetaDissPlusXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/jcca-xmetadissplus-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("xMetaDissPlus", xMetaDissPlusXsltString);
String oaiDcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/jcca-oai_dc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("https://journals.sub.uni-hamburg.de/giga/jcca/oai/", map);
/*
XsltTransformerOaiPmhBundlesStreamSource bss =
new XsltTransformerOaiPmhBundlesStreamSource(
"https://journals.sub.uni-hamburg.de/giga/jcca/oai/", map, LocalDate.parse("2017-01-01"), LocalDate.parse("2017-07-01") );
*/
Bundle bundle = bss.getBundle("oai:hup.sub.uni-hamburg.de.giga:article/968");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "The Evolution of China’s Pay Inequality from 1987 to 2012") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Zhang, Wenjie") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.journal", "Journal of Current Chinese Affairs") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "Marginalisation and State Intervention in China") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "45") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "2") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "This paper provides new estimates of the evolution of pay inequality in China, overall and also by region and sector, in the period from 1987 to 2012, using the between-group component of Theil’s T-statistic measured across regions and sectors. We find that China’s overall pay inequality started to rise rapidly in the early 1990s and that it peaked in 2008, with the between-province component peaking as early as 2002. Since 2008, overall pay inequality has decreased, with between-province and between-sector inequality both showing steady declines. We argue that China’s pay inequality during the reform period was not simply a matter of economic inequality; it was the joint product of both market and institutional forces. In this vein, we also argue that the recent decline of overall pay inequality after the 2008 global economic crisis was not a temporary phenomenon triggered by the global downturn, but a long-term outcome driven by both economic and policy factors.") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "China; regional disparities; urbanization; development plans; pay inequality") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "1868-4874") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.urn", "urn:nbn:de:gbv:18-4-9687") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.uri", "https://journals.sub.uni-hamburg.de/giga/jcca/article/download/968/975") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://journals.sub.uni-hamburg.de/giga/jcca/article/view/968") ) );
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", "330") ) );
assertTrue( metadata.stream().noneMatch( m -> m.getKey().equals("dc.title.alternative") ) );
bundle = bss.getBundle("oai:hup.sub.uni-hamburg.de.giga:article/1046");
metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "Getting the Numbers Right on China’s Actual Overseas Investment: The Case of the Netherlands") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Jong, Piter de") ) ); // yes, double space :(
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Greeven, Mark J.") ) ); // yes, double space :(
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Ebbers, Haico") ) );
}
@Test
public void getSinglePublicationJpla() throws IOException {
Map<String, String> map = new HashMap<>();
String xMetaDissPlusXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/jpla-xmetadissplus-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("xMetaDissPlus", xMetaDissPlusXsltString);
String oaiDcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/jpla-oai_dc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("https://journals.sub.uni-hamburg.de/giga/jpla/oai/", map);
/*
XsltTransformerOaiPmhBundlesStreamSource bss =
new XsltTransformerOaiPmhBundlesStreamSource(
"https://journals.sub.uni-hamburg.de/giga/jcca/oai/", map, LocalDate.parse("2017-01-01"), LocalDate.parse("2017-07-01") );
*/
Bundle bundle = bss.getBundle("oai:hup.sub.uni-hamburg.de.giga:article/1057");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "Unusual Bedfellows? PRI–PVEM Electoral Alliances in Mexican Legislative Elections") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title.alternative", "es", "¿Parejas Inusuales? Las Alianzas Electorales del PRI y el PVEM en las Elecciones Legislativas en México") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Spoon, Jae-Jae") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Gómez, Amalia Pulido") ) ); // yes, double space :(
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.journal", "Journal of Politics in Latin America") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "9") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "2") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "We examine the electoral alliances between two Mexican political parties – the Partido Revolucionario Institucional (PRI) and the Partido Verde Ecologista de México (PVEM). Despite the PRI’s electoral dominance, it has entered into preelection agreements with the PVEM since 2003. These electoral pacts are unusual for several reasons: the parties do not share an ideology; their bases of support come from different social sectors; and the PRI’s survival as a party does not depend on these pacts. Using electoral data from 2006 to 2015, we examine the electoral districts in which the PRI and the PVEM ran joint candidates in federal legislative elections. We find that the ultimate goals of each party, their past electoral performances at the legislative district level, and the presence of PRI–PVEM alliances in gubernatorial elections explain the parties’ choices to collaborate in certain districts. Our findings have important implications for understanding the behavior of parties in newer democracies.") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "es", "En este trabajo analizamos las alianzas electorales entre el Partido Revolucionario Institucional (PRI) y el Partido Verde Ecologista de México (PVEM). A pesar de su dominio electoral, el PRI ha celebrado alianzas electorales con el PVEM desde el 2003. Estos acuerdos electorales son inusuales por varias razones: los partidos no comparten una ideología; sus bases electorales son de diferentes sectores sociales; y la sobrevivencia del PRI en el sistema electoral no depende de la alianza con el PVEM. Utilizando datos electorales de las elecciones legislativas para el período de 2006 a 2015, examinamos los distritos electorales en los cuales el PRI y el PVEM compiten en alianza. Encontramos que los objetivos individuales de cada partido, su desempeño electoral previo en los distritos electorales y la presencia de la alianza PRI-PVEM en las elecciones gubernamentales predicen la decisión de ambos partidos de colaborar en ciertos distritos. Nuestros hallazgos tienen implicaciones relevantes para entender el comportamiento de los partidos políticos en democracias nuevas.") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "Political Science; Social Sciences") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "Estudios Políticos; economía política") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "Mexico; electoral alliances; elections; political parties") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "México; alianzas electorales; elecciones; partidos políticos") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "1868-4890") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.urn", "urn:nbn:de:gbv:18-4-10578") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.uri", "https://journals.sub.uni-hamburg.de/giga/jpla/article/download/1057/1064") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://journals.sub.uni-hamburg.de/giga/jpla/article/view/1057") ) );
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", "2017") ) );
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", "322") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "327") ) );
assertTrue( metadata.stream().noneMatch( m -> m.getKey().equals("dc.source.issuetopic") ) );
bundle = bss.getBundle("oai:hup.sub.uni-hamburg.de.giga:article/277");
metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "No Country for Leftists? Clientelist Continuity and the 2006 Vote in the Brazilian Northeast") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "2") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "Subnational Authoritarianism and Democratization in Latin America") ) ); // yes, double space :(
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.pageinfo", "113-153") ) );
}
}
......@@ -48,9 +48,9 @@
see e.g. http://journals.sub.uni-hamburg.de/giga/afsp/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:hup.sub.uni-hamburg.de.giga:article/29
see e.g. http://journals.sub.uni-hamburg.de/giga/afsp/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:hup.sub.uni-hamburg.de.giga:article/990
-->
<!-- dc:source may contain an issue topic ... if it exists, it is between ': ' and ';' -->
<xsl:variable name="issuetopic" select="substring-before(substring-after(., ': '), ';')" />
<!-- <xsl:message terminate="no">issuetopic=<xsl:value-of select="$issuetopic"/></xsl:message> -->
<!-- dc:source may contain an issue topic ... if it exists, it is between ': ' and OPTIONALLY ';' -->
<!-- optionally as in https://stackoverflow.com/a/3100284/923560 -->
<xsl:variable name="issuetopic" select="substring-before( concat( substring-after(., ': '), ';'), ';')" />
<xsl:if test="$issuetopic != ''">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.issuetopic'"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xoai="http://www.lyncode.com/xoai"
xmlns:xMetaDiss="http://www.d-nb.de/standards/xmetadissplus/"
xmlns:cc="http://www.d-nb.de/standards/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:pc="http://www.d-nb.de/standards/pc/"
xmlns:urn="http://www.d-nb.de/standards/urn/"
xmlns:hdl="http://www.d-nb.de/standards/hdl/"
xmlns:doi="http://www.d-nb.de/standards/doi/"
xmlns:thesis="http://www.ndltd.org/standards/metadata/etdms/1.0/"
xmlns:ddb="http://www.d-nb.de/standards/ddb/"
xmlns:dini="http://www.d-nb.de/standards/xmetadissplus/type/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zoai="http://git.gesis.org/dda/zoai">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- <xsl:copy-of select="."/> -->
<!-- <xsl:message terminate="no">here is some message for stderr, e.g. <xsl:value-of select='text()' /> </xsl:message> -->
<!-- override default template -->
<xsl:template match="*" />
<xsl:template match="/">
<xsl:element name="bundle">
<xsl:element name="metadata">
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc">
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="dc:source">
<!--
dc.source.pageinfo and dc.source.issuetopic may or may not exist in oai_dc's dc:source ...
see e.g. http://journals.sub.uni-hamburg.de/giga/afsp/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:hup.sub.uni-hamburg.de.giga:article/29
see e.g. http://journals.sub.uni-hamburg.de/giga/afsp/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:hup.sub.uni-hamburg.de.giga:article/990
-->
<!-- dc:source may contain an issue topic ... if it exists, it is between ': ' and OPTIONALLY ';' -->
<!-- optionally as in https://stackoverflow.com/a/3100284/923560 -->
<xsl:variable name="issuetopic" select="substring-before( concat( substring-after(., ': '), ';'), ';')" />
<xsl:if test="$issuetopic != ''">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.issuetopic'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$issuetopic"/>
</xsl:call-template>
</xsl:if>
<!-- dc:source may contain page information ... if it exists and follows the pattern 123(-125), it is after the last '; ' occurrence -->
<xsl:variable name="pageinfo" select="tokenize(text(),'; ')[last()]" />
<!-- <xsl:message terminate="no">pageinfo=<xsl:value-of select="$pageinfo"/></xsl:message> -->
<xsl:if test="$pageinfo != '' and matches($pageinfo, '^\d+(-\d+)?')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.pageinfo'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$pageinfo"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="new-metadatum">
<xsl:param name="key" />
<xsl:param name="language" />
<xsl:param name="value" />
<xsl:element name="metadatum">
<xsl:element name="key">
<xsl:value-of select="$key" />
</xsl:element>
<xsl:if test="$language != ''">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage($language)" />
<xsl:element name="language">
<xsl:value-of select="$sanitizedLanguage" />
</xsl:element>
</xsl:if>
<xsl:element name="value">
<xsl:value-of select="$value" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:function name="zoai:sanitizeLanguage">
<xsl:param name="inputLanguage" />
<xsl:choose>
<xsl:when test="$inputLanguage = 'ger'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'eng'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$inputLanguage" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:xoai="http://www.lyncode.com/xoai"
xmlns:xMetaDiss="http://www.d-nb.de/standards/xmetadissplus/"
xmlns:cc="http://www.d-nb.de/standards/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:pc="http://www.d-nb.de/standards/pc/"
xmlns:urn="http://www.d-nb.de/standards/urn/"
xmlns:hdl="http://www.d-nb.de/standards/hdl/"
xmlns:doi="http://www.d-nb.de/standards/doi/"
xmlns:thesis="http://www.ndltd.org/standards/metadata/etdms/1.0/"
xmlns:ddb="http://www.d-nb.de/standards/ddb/"
xmlns:dini="http://www.d-nb.de/standards/xmetadissplus/type/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zoai="http://git.gesis.org/dda/zoai">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- <xsl:copy-of select="."/> -->
<!-- <xsl:message terminate="no">here is some message for stderr, e.g. <xsl:value-of select='text()' /> </xsl:message> -->
<!-- override default template -->
<xsl:template match="*" />
<!--
dc.source.pageinfo and dc.source.issuetopic may or may not exist in oai_dc's dc:source ...
see e.g. http://journals.sub.uni-hamburg.de/giga/afsp/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:hup.sub.uni-hamburg.de.giga:article/29
see e.g. http://journals.sub.uni-hamburg.de/giga/afsp/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:hup.sub.uni-hamburg.de.giga:article/990
-->
<xsl:template match="/">
<xsl:element name="bundle">
<xsl:element name="metadata">
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/xMetaDiss:xMetaDiss" />
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:header" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.stock'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'article'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.document'"/>
<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="'Journal of Current Chinese Affairs'"/>
</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="'27'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.pubstatus'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1'"/>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/xMetaDiss:xMetaDiss">
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:header">
<xsl:apply-templates></xsl:apply-templates>
</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:creator">
<xsl:variable name="fullName" select="concat( pc:person/pc:name/pc:surName, ', ', pc:person/pc:name/pc:foreName )" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.contributor.author'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$fullName"/>
</xsl:call-template>
</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="dcterms:abstract">
<xsl:variable name="language" select="@lang" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.abstract'"/>
<xsl:with-param name="language" select="$language"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dcterms:issued">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.date.issued'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="substring( text(), 1, 4)"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:identifier[@xsi:type='urn:nbn']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.urn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:language[@xsi:type='dcterms:ISO639-2']">
<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="zoai:sanitizeLanguage( text() )"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dcterms:isPartOf[@xsi:type='ddb:ZSTitelID']">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dcterms:isPartOf[@xsi:type='ddb:ZS-Volume']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.volume'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dcterms:isPartOf[@xsi:type='ddb:ZS-Issue']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.issue'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="ddb:transfer[@ddb:type='dcterms:URI']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.uri'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="ddb:identifier[@ddb:type='URL']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.url'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</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() = 'jcca:RESART' or text() = 'jcca:FEATURED-Analyses' or text() = 'jcca:ANA'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.review'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.review'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'2'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="new-metadatum">
<xsl:param name="key" />