Commit 9338c995 authored by Jakowatz, Stefan's avatar Jakowatz, Stefan

pps

parent 6455b127
......@@ -1281,6 +1281,72 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
}
@Test
public void getSinglePublicationPublicPolicyStudies() throws IOException {
Map<String, String> map = new HashMap<>();
String oaiDcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/publicPolicyStudies-oai_dc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("https://econjournals.sgh.waw.pl/KSzPP/oai/", map);
Bundle bundle = bss.getBundle("oai:ojs2.econjournals.sgh.waw.pl:article/568");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
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", "Studia z Polityki Publicznej / Public Policy Studies") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Woźnicki, Jerzy") ) );
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", "2014") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "Sphere of values and related to them determinants of policy making constitute current issues in the social sciences. The author presents good practices in terms of partnerships among actors in the process of creation, implementation and evaluation of public policy, emphasizing their axiological foundations. This is primarily applicable in the knowledge sector which is an area particularly sensitive on the institutional ground because of great aspirations of the creators engaged. The article explains the concept of the knowledge sector using a group of related terms such as knowledge society, information society, knowledge-based economy, knowledge management and formulates a number of recommendations for development of this sector. The author presents the institutional structure of the knowledge sector in functional terms with emphasis on the demand of their greater integration in the pro-development activities. Subsequently, there is a presentation of constitutional norms, based on which the social dialogue and partnership are suggested as fundamental principles in the knowledge sector. The author examines the mission of the state emphasizing the importance of its role as a guarantor of these values and rules. Finally, the article presents the instruments of public policy towards the knowledge sector focusing on the importance of the principles and best practices in cooperation between public policy makers and their social partners – the creators of knowledge.") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "pl", "Sfera wartości i związane z nimi uwarunkowania polityki to zagadnienia aktualne w naukach społecznych. Autor prezentuje dobre praktyki w zakresie partnerstwa pomiędzy aktorami w procesie kreowania, realizacji i ewaluacji polityki publicznej, podkreślając ich fundamenty aksjologiczne. Ma to zwłaszcza zastosowanie wobec sektora wiedzy jako obszaru szczególnie wrażliwego na gruncie instytucjonalnym ze względu na duże aspiracje zaangażowanych twórców. Artykuł przedstawia pojęcie sektora wiedzy na tle określeń powiązanych, takich jak: społeczeństwo wiedzy, społeczeństwo informacyjne, gospodarka oparta na wiedzy, zarządzanie wiedzą, a także formułuje pewne zalecenia dotyczące rozwoju tego sektora. Autor prezentuje strukturę podmiotową sektora wiedzy w ujęciu funkcjonalnym, z podkreśleniem postulatu większej integracji instytucjonalnej w działaniach prorozwojowych. W artykule prezentowane są normy konstytucyjne, a na ich tle postulowane zasady dialogu społecznego i partnerstwa jako zasady fundamentalne w sektorze wiedzy. Autor analizuje misję państwa, podkreślając znaczenie jego roli jako gwaranta tych reguł. Artykuł przedstawia instrumentarium polityki publicznej wobec sektora wiedzy, z podkreśleniem znaczenia zasad i dobrych praktyk we współdziałaniu realizatorów polityki publicznej z kreatorami wiedzy jako ich partnerami środowiskowymi.") ) );
assertEquals(2, metadata.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "2719-7131") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://econjournals.sgh.waw.pl/KSzPP/article/view/568") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "pl") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "1") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issuetopic", "Post-Snowden Internet Policy") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.pageinfo", "11-31") ) );
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", "en", "public policy") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "knowledge sector") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "norms") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "good practices") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "en", "surveillance") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "pl", "Dedykowane normy konstytucyjne i dobre praktyki w realizacji polityki publicznej wobec sektora wiedzy") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title.alternative", "en", "Constitutional Norms and Good Practices Dedicated to The Implementation of Public Policy Towards The Knowledge Sector") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.title.alternative") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.33119/KSzPP.2014.1.1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "POL") ) );
Set<InputStream> fileSet = bundle.getContents();
assertTrue( fileSet.size() == 1);
LOG.info("---------------------------------------");
bundle = bss.getBundle("oai:ojs2.econjournals.sgh.waw.pl:article/579");
LOG.info("{}", bundle);
metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.title.alternative", "en", "Book review: Contemporary state and public debt. Dilemmas and myths") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.stock", "recension") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.document", "23") ) );
// 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<>();
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.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_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
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: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: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="'Studia z Polityki Publicznej / Public Policy Studies'" />
</xsl:call-template>
<!-- xsl:call-template name="new-metadatum"> <xsl:with-param name="key"
select="'internal.identifier.journal'"/> <xsl:with-param name="language"
select="''"/> <xsl:with-param name="value" select="'1690'"/> </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="'POL'" />
</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="'dc.identifier.issn'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'2719-7131'" />
</xsl:call-template>
<!-- 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="'300'"/> </xsl:call-template> <xsl:call-template
name="new-metadatum"> <xsl:with-param name="key" select="'dc.subject.ddc'"/>
<xsl:with-param name="language" select="''"/> <xsl:with-param name="value"
select="'300'"/> </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:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="dc:language">
<xsl:variable name="sanitizedLanguage"
select="zoai:sanitizeLanguage( text() )" />
<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="$sanitizedLanguage" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:creator">
<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="dc:date">
<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:description[@xml:lang='pl-PL']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.abstract'" />
<xsl:with-param name="language" select="'pl'" />
<xsl:with-param name="value"
select="normalize-space(replace(text(),'[»«]','&quot;'))" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:description[@xml:lang='en-US']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.abstract'" />
<xsl:with-param name="language" select="'en'" />
<xsl:with-param name="value"
select="normalize-space(replace(text(),'[»«]','&quot;'))" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:source[@xml:lang='en-US']">
<xsl:variable name="pageinfo"
select="tokenize( text(),'; ' )[last()]" />
<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:variable name="issue"
select="substring-before(substring-after(text(),'No '),'(')" />
<xsl:if test="$issue != '' and matches ($issue, '\d+')">
<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="$issue" />
</xsl:call-template>
</xsl:if>
<xsl:variable name="volume"
select="substring-before(substring-after(text(),'Vol '),' ')" />
<xsl:if test="$volume != '' and matches ($volume, '\d+')">
<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="$volume" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="dc:subject[@xml:lang='en-US']">
<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="text()" />
</xsl:call-template>
<xsl:choose>
<xsl:when test="text()='book review'">
<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="'recension'" />
</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="'23'" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<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:otherwise>
</xsl:choose>
<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:template>
<xsl:template
match="dc:identifier[matches(text(), '^10\..*')]">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.identifier.doi'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="concat('https://doi.org/', text())" />
</xsl:call-template>
</xsl:template>
<xsl:template
match="dc:identifier[matches(text(), 'econjournals.sgh.waw.pl.')]">
<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="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="replace(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="replace(text(), '\.$','')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</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' or $inputLanguage = 'DE' or $inputLanguage = 'de-DE' or $inputLanguage = 'deu'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when
test="$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US' or $inputLanguage = 'en-GB'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:when
test="$inputLanguage = 'pol' or $inputLanguage = 'PL' or $inputLanguage = 'pl-PL'">
<xsl:value-of select="'pl'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$inputLanguage" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
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