Commit 581542c4 authored by Steinberg, Jan's avatar Steinberg, Jan
Browse files

doabooks

parent 8e31d63d
......@@ -8,6 +8,7 @@ import org.gesis.dda.feeder.NextIncrementalHarvestingIntervalStrategy;
import org.gesis.dda.filter.BundleFilter;
import org.gesis.dda.filter.impl.AcceptAnyBundleFilter;
import org.gesis.dda.filter.impl.Aseas2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Doabooks2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Fqs2SsoarBundleFilter;
import org.gesis.dda.filter.impl.SsoarTargetRepositoryBundleFilter;
import org.gesis.dda.filter.impl.Wbv2SsoarBundleFilter;
......@@ -138,6 +139,10 @@ public class FeedingContextFactory {
log.info("using Wzb2SsoarBundleFilter");
result = new Wzb2SsoarBundleFilter();
break;
case "https://doabooks.org/oai@@oai:doab-books":
log.info("using Doabooks2SsoarBundleFilter");
result = new Doabooks2SsoarBundleFilter();
break;
default:
log.debug("using default IdentityMetadataTransformer");
result = new AcceptAnyBundleFilter();
......
package org.gesis.dda.filter.impl;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import org.gesis.dda.filter.BundleFilter;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.Metadatum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Doabooks2SsoarBundleFilter implements BundleFilter {
private final static Logger LOG = LoggerFactory.getLogger(Doabooks2SsoarBundleFilter.class);
/**
* SSOAR only gets the given class notation's publications from this source
*/
@Override
public boolean test(Bundle bundle) {
LOG.debug("doabooks filter...");
boolean result;
String[] valuesToBeFilteredTo = {"Political institutions and public administration (General)",
"Political science",
"Political science (General)",
"Political theory"};
Set<Metadatum> metadata = bundle.getMetadata();
Set<Metadatum> clasShorts = metadata.stream().filter( m -> m.getKey().equals("dc.subject.classhort") ).collect(Collectors.toSet());
if (null != clasShorts.stream().filter(cls -> Arrays.asList(valuesToBeFilteredTo).contains(cls.getValue()))) {
LOG.debug("clasShort-Set not null.");
if (clasShorts.stream().filter(cls -> Arrays.asList(valuesToBeFilteredTo).contains(cls.getValue())).count() > 0) {
result = true;
LOG.debug("We take it: {}", clasShorts.stream().map(Metadatum::getValue).collect(Collectors.joining("; ")));
}
else {
result = false;
LOG.debug("Filtered away because of: {}", clasShorts.stream().map(Metadatum::getValue).collect(Collectors.joining("; ")));
}
return result;
} else {
LOG.error("null pointer?");
return false;
}
}
}
......@@ -783,6 +783,145 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
}
@Test
public void getSinglePublicationDoabooks() throws IOException {
Map<String, String> map = new HashMap<>();
String oaiMarcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/doabooks-marcxml-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("marcxml", oaiMarcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("https://doabooks.org/oai", map);
Bundle bundle = bss.getBundle("oai:doab-books:12555");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.stock", "monograph") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.document", "20") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Marranci, Gabriele") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.contributor.author") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.date.issued", "2006") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher", "Berg Publishers") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "'Jihad' is a highly charged word. Often mistranslated as 'Holy War', it has become synonymous with terrorism. Current political events have entirely failed to take account of the subtlety and complexity of jihad. Like many concepts with a long history, different cultural ideas have influenced the religious aspects of jihad. As a result its original meaning has been adapted, modified and destabilized - never more than at the present time. How does jihad manifest itself in Muslims' everyday lives? What impact has 9/11 and its backlash had on jihad? By observing the current crisis of identity among ordinary Muslims, this timely book explores why, and in what circumstances Muslims speak of jihad. In the end, jihad is what Muslims say it is. Marranci offers us a nuanced and sophisticated anthropological understanding of Muslims' lives far beyond the predictable cliches.&lt;br/&gt;&lt;br/&gt;Have a look at the author´s blog &lt;a href=\"http://marranci.wordpress.com/\"&gt;here&lt;/a&gt;Explores the different cultural ideas that have influenced the religious&lt;br/&gt;&lt;br/&gt; aspects of jihad. 'jihad', a term often mistranslated as 'Holy War', &lt;br/&gt;&lt;br/&gt;has become synonymous with terrorism. This book, by observing the crisis&lt;br/&gt;&lt;br/&gt; of identity among ordinary Muslims, explores why, and in what &lt;br/&gt;&lt;br/&gt;circumstances Muslims speak of jihad.Gabriele Marranci is Lecturer in the Anthropology of Religion, School of Divinity and Religious Studies, University of Aberdeen. He is the founding editor of Contemporary Islam: Dynamics of Muslim Life.") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.isbn", "9781847881298") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://www.doabooks.org/doab?func=fulltext&rid=12555") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "3") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "Sustainable Planning and Technologies") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.pageinfo", "192") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "sociology") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "anthropology") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classhort", "en", "Ethnology. Social and cultural anthropology") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classhort", "en", "Sociology (General)") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "ICT") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "socio-cultural") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "Jihad Beyond Islam") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.17645/up.v1i3.686") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "PRT") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classoz", "20700") ) );
assertTrue( metadata.contains( new SimpleMetadatum("ssoar.urn.registration", "false") ) );
// 12703
Bundle bundle2 = bss.getBundle("oai:doab-books:12703");
LOG.info("{}", bundle2);
Set<Metadatum> metadata2 = bundle2.getMetadata();
metadata2.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata2.contains( new SimpleMetadatum("dc.type.stock", "monograph") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.type.document", "20") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Besamusca, Bart") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Bouwman, Andre") ) );
assertEquals(2, metadata2.stream().filter(m -> m.getKey().equals("dc.contributor.author") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.date.issued", "2009") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.publisher", "Amsterdam University Press") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.abstract", "en", "The mid thirteenth-century Dutch beast epic Van den vos Reynaerde is a fascinating reworking of the most popular branch of the Old French Roman de Renart and one of the finest examples of this popular genre, consisting of a lengthy cycle of animal tales which provided a satirical commentary on human society. Featuring the archetypal sly fox, the epic is also one of earliest examples of a longer literary work written in the Dutch vernacular. This charmingly illustrated edition contains the first-ever version of the Dutch text with a facing English translation, making the undisputed masterpiece of medieval Dutch literature accessible to international scholarly audiences otherwise unable to read the narrative in the original. The critical text and the parallel translation are accompanied by an introduction, interpretative notes, an index of names, a complete glossary, and a short introduction to Middle Dutch, making it an excellent choice for undergraduate or graduate study of medieval European literature.") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.isbn", "9789089640246") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.url", "https://www.doabooks.org/doab?func=fulltext&rid=12703") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
// assertTrue( metadata2.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "3") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "Sustainable Planning and Technologies") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.pageinfo", "368") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "1") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.other", "nederlandse en vlaamse literatuur") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.other", "educatie") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.classhort", "en", "Education (General)") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.classhort", "en", "Literature (General)") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "ICT") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "socio-cultural") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.title", "Of Reynaert the Fox") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.17645/up.v1i3.686") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "PRT") ) );
// assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.classoz", "20700") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("ssoar.urn.registration", "false") ) );
}
@Test
public void getSinglePublicationDoabooks2() throws IOException {
Map<String, String> map = new HashMap<>();
String oaiMarcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/doabooks-marcxml-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("marcxml", oaiMarcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("https://doabooks.org/oai", map);
Bundle bundle = bss.getBundle("oai:doab-books:12580");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.stock", "monograph") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.document", "20") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Bellamy, Alex J.") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.contributor.author") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.date.issued", "2003") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher", "Manchester University Press") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "This volume assesses the formation of Croatian national identity in the 1990s. It develops a novel framework calling into question both primordial and modernist approaches to nationalism and national identity before applying that framework to Croatia. In doing so it provides a new way of thinking about how national identity is formed and why it is so important. An explanation is given of how Croatian national identity was formed in the abstract, via a historical narrative that traces centuries of yearning for a national state. The book shows how the government, opposition parties, dissident intellectuals and diaspora groups offered alternative accounts of this narrative in order to legitimise contemporary political programmes based on different visions of national identity. It then looks at how these debates were manifested in social activities as diverse as football and religion, economics and language. This volume marks an important contribution to both the way we study nationalism and national identity, and our understanding of post-Yugoslav politics and society.") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.isbn", "9780719065026") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://www.doabooks.org/doab?func=fulltext&rid=12580") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "3") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "Sustainable Planning and Technologies") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.pageinfo", "192") ) );
assertEquals(0, metadata.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "nationalism") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "croatia") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classhort", "en", "Political theory") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "ICT") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "socio-cultural") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "The formation of Croatian national identity: A centuries-old dream?") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.17645/up.v1i3.686") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "PRT") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classoz", "20700") ) );
assertTrue( metadata.contains( new SimpleMetadatum("ssoar.urn.registration", "false") ) );
}
@Test
public void getSinglePublicationUrbanPlanning() throws IOException {
Map<String, String> map = new HashMap<>();
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
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:ddb="http://www.d-nb.de/standards/ddb/"
xmlns:dini="http://www.d-nb.de/standards/xmetadissplus/type/"
xmlns:doi="http://www.d-nb.de/standards/doi/"
xmlns:hdl="http://www.d-nb.de/standards/hdl/"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:nlm="http://dtd.nlm.nih.gov/publishing/2.3"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oai_marc="http://www.openarchives.org/OAI/1.1/oai_marc"
xmlns:marcxml="http://www.loc.gov/MARC21/slim"
xmlns:pc="http://www.d-nb.de/standards/pc/"
xmlns:thesis="http://www.ndltd.org/standards/metadata/etdms/1.0/"
xmlns:urn="http://www.d-nb.de/standards/urn/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xMetaDiss="http://www.d-nb.de/standards/xmetadissplus/"
xmlns:xoai="http://www.lyncode.com/xoai"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:zoai="http://git.gesis.org/dda/zoai"
>
<xsl:output 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> -->
<!--
<xsl:for-each select="./*">
<xsl:message terminate="no">a child=<xsl:value-of select="name()"/></xsl:message>
</xsl:for-each>
-->
<!-- override default template -->
<xsl:template match="*" />
<xsl:template match="/">
<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:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.dda.reference'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$ddaReference"/>
</xsl:call-template>
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/marcxml:record" />
<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="'monograph'"/>
</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="'20'"/>
</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="'16'"/>
</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:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.publisher.country'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'MISC'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'ssoar.urn.registration'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'false'"/>
</xsl:call-template>
<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:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.status'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'formal und inhaltlich fertig erschlossen'"/>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/marcxml:record">
<xsl:apply-templates select="marcxml:datafield[@tag='020']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='100']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='245']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='300']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='520']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='546']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='260']/child::node()[@code='b']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='260']/child::node()[@code='c']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='650']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='653']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='700']/child::node()[@code='a']"/>
<xsl:apply-templates select="marcxml:datafield[@tag='720']/child::node()[@code='a']"/>
<!--xsl:apply-templates select="marcxml:datafield[@tag='786']/child::node()[@code='n']"/-->
<xsl:apply-templates select="marcxml:datafield[@tag='856']/child::node()[@code='u']"/>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='020']/child::node()[@code='a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.isbn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='100']/child::node()[@code='a']">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='245']/child::node()[@code='a']">
<xsl:variable name="lngg">
<xsl:choose>
<xsl:when test="//marcxml:datafield[@tag='546']/child::node()[@code='a'][1]">
<xsl:value-of select="zoai:sanitizeLanguage( //marcxml:datafield[@tag='546']/child::node()[@code='a'][1]/text() )"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>de</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'"/>
<xsl:with-param name="language" select="$lngg"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='260']/child::node()[@code='b']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.publisher'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='260']/child::node()[@code='c']">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='300']/child::node()[@code='a']">
<xsl:if test="string-length(replace(substring-before(substring-after(text(), '('), ')'), ' [pS]\.?', '')) > 0">
<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="replace(substring-before(substring-after(text(), '('), ')'), ' [pS]\.?', '')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='520']/child::node()[@code='a']">
<xsl:variable name="lngg">
<xsl:choose>
<xsl:when test="//marcxml:datafield[@tag='546']/child::node()[@code='a'][1]">
<xsl:value-of select="zoai:sanitizeLanguage( //marcxml:datafield[@tag='546']/child::node()[@code='a'][1]/text() )"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>de</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.abstract'"/>
<!--xsl:with-param name="language" select="$lngg"/-->
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='546']/child::node()[@code='a']">
<xsl:if test="string-length(zoai:sanitizeLanguage(text()))=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:if>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='650']/child::node()[@code='a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classhort'"/>
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="text() = 'Political institutions and public administration (General)'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10501'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10501'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'40200'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'40200'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with(text(), 'Political science')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10501'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10501'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="text() = 'Political theory'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10501'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10501'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='653']/child::node()[@code='a']">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='700']/child::node()[@code='a']">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="marcxml:datafield[@tag='720']/child::node()[@code='a']">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<!--xsl:template match="marcxml:datafield[@tag='786']/child::node()[@code='n']">
<xsl:if test="contains(text(), ' Том ')">
<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="replace(replace(text(), '^.* Том ', ''), ' .*$', '')"/>
</xsl:call-template>
</xsl:if>
<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="replace(replace(text(), '^.*№ ', ''), ' +.*$', '')"/>
</xsl:call-template>
<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="replace(replace(text(), '^.*\(', ''), '\).*$', '')"/>
</xsl:call-template>
</xsl:template-->
<xsl:template match="marcxml:datafield[@tag='856']/child::node()[@code='u']">
<xsl:if test="starts-with(text(), 'https://www.doabooks.org/doab')">
<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: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 = 'de' or$inputLanguage = 'ger' or $inputLanguage = 'DE' or $inputLanguage = 'de-DE' or $inputLanguage = 'deu' or $inputLanguage = 'Deutsch' or $inputLanguage = 'German' or $inputLanguage = 'german'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'en' or$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US' or $inputLanguage = 'en-GB' or $inputLanguage = 'English' or $inputLanguage = 'english'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'ita' or $inputLanguage = 'IT' or $inputLanguage = 'it-IT' or $inputLanguage = 'Italian' or $inputLanguage = 'italian'">
<xsl:value-of select="'it'" />
</xsl:when>
<xsl:otherwise>
<xsl:text></xsl:text>
</xsl:otherwise>