Commit f7a7dc9b by Steinberg, Jan

HJK - xslt and test

parent af22223d
......@@ -230,6 +230,108 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
}
@Test
public void getSinglePublicationHjk() throws IOException {
Map<String, String> map = new HashMap<>();
// String oaiMarcXsltString = IOUtils.toString(
// getClass().
// getClassLoader().
// getResourceAsStream("xslt/hjk-oai_marc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
// map.put("oai_marc", oaiMarcXsltString);
//
String oaiDcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/hjk-oai_dc-2-xmlbundle2.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("http://journals.sub.uni-hamburg.de/hjk/oai/", map);
Bundle bundle = bss.getBundle("oai:ojs.journals.sub.uni-hamburg.de:article/756");
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", "1439") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Koch, Gertraud") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Warneken, Bernd Jürgen") ) );
assertEquals(2, 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", "de", "\"Deutschland ist ein reiches Land\" – dieses Bild dürften die meisten Menschen teilen, auch wenn es brüchig wird, wo doch Obdachlose und Bettler_innen in den Innenstädten, Tafeln und Kleiderkammern, Umsonstläden und Lebensmittelausgabestellen für Bedürftige eine andere Wirklichkeit zeigen. In Hamburg ist diese Spanne von Reich und Arm in besonderer Weise prägend.") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "2365-1016") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "https://journals.sub.uni-hamburg.de/hjk/article/view/756/759") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "de") ) );
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", "24") ) );
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") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "de", "oben_unten. Bilder vom Leben der Anderen") ) );
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("internal.dda.reference", "http://journals.sub.uni-hamburg.de/hjk/oai/@@oai:ojs.journals.sub.uni-hamburg.de:article/756") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "DEU") ) );
// 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") ) );
Set<InputStream> fileSet = bundle.getContents();
assertEquals( 1, fileSet.size());
// an english one
Bundle bundle2 = bss.getBundle("oai:ojs.journals.sub.uni-hamburg.de:article/826");
LOG.info("{}", bundle2);
Set<Metadatum> metadata2 = bundle2.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata2.contains( new SimpleMetadatum("dc.type.stock", "article") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.type.document", "32") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.journal", "1439") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Löfgren, Orvar") ) );
assertEquals(1, 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", "2015") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.abstract", "de", "This paper looks at collecting practices in the everyday world of universities. How do scholars turn into hoarding squirrels, creating their own archives? My focus is on routines and technologies, which deal with storage and order as well as retrieving and discarding of research materials.") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.issn", "2365-1016") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.url", "https://journals.sub.uni-hamburg.de/hjk/article/view/826/806") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.language", "de") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.issue", "3") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.source.issue") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.rights.licence", "24") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.issuetopic", "SAMMELN : Zur Geschichte und Gegenwart einer alltäglichen, musealen und wissenschaftlichen Praxis") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.source.issuetopic") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.pageinfo", "17-33") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.title", "de", "The Scholar as Squirrel: Everyday Collecting in Academia") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.urn", "urn:nbn:de:gbv:18-8-8269") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("internal.dda.reference", "http://journals.sub.uni-hamburg.de/hjk/oai/@@oai:ojs.journals.sub.uni-hamburg.de:article/826") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.publisher.country", "DEU") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.classoz", "10900") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classoz", "10900") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("internal.identifier.ddc", "300") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.ddc", "300") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("internal.status", "formal und inhaltlich fertig erschlossen") ) );
Set<InputStream> fileSet2 = bundle2.getContents();
assertEquals( 1, fileSet2.size());
}
@Test
public void getSinglePublicationJcca() throws IOException {
Map<String, String> map = new HashMap<>();
String xMetaDissPlusXsltString = IOUtils.toString(
......
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