From f2a08d8cc28f078eb0ce7216f4bfa78db0063beb Mon Sep 17 00:00:00 2001 From: Alessia Bardi Date: Tue, 30 Jan 2024 19:20:14 +0100 Subject: [PATCH] test for Italian records from IRS repositories --- .../dnetlib/dhp/oa/graph/raw/MappersTest.java | 15 ++ .../eu/dnetlib/dhp/oa/graph/raw/iris-odf.xml | 215 ++++++++++++++++++ .../oa/provision/XmlRecordFactoryTest.java | 23 ++ .../dnetlib/dhp/oa/provision/iris-odf-4.json | 1 + 4 files changed, 254 insertions(+) create mode 100644 dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/iris-odf.xml create mode 100644 dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/iris-odf-4.json diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java index ac0435ce2..bbb8e7d57 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java @@ -1250,6 +1250,21 @@ class MappersTest { System.out.println("***************"); } + @Test + void testIRISPub() throws IOException, DocumentException { + final String xml = IOUtils.toString(Objects.requireNonNull(getClass().getResourceAsStream("iris-odf.xml"))); + final List list = new OdfToOafMapper(vocs, false, true).processMdRecord(xml); + System.out.println("***************"); + System.out.println(new ObjectMapper().writeValueAsString(list)); + System.out.println("***************"); + final Publication p = (Publication) list.get(0); + assertNotNull(p.getInstance().get(0).getUrl().get(0)); + assertValidId(p.getId()); + System.out.println(p.getInstance().get(0).getUrl()); + p.getPid().forEach(x -> System.out.println(x.getValue())); + p.getInstance().get(0).getAlternateIdentifier().forEach(x -> System.out.println(x.getValue())); + + } @Test void testNotWellFormed() throws IOException { final String xml = IOUtils diff --git a/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/iris-odf.xml b/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/iris-odf.xml new file mode 100644 index 000000000..1b875ec36 --- /dev/null +++ b/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/iris-odf.xml @@ -0,0 +1,215 @@ + + + + oai:air.unimi.it:2434/907506 + 2024-01-04T12:42:51Z + com_2434_73555 + col_2434_73557 + openaire + 2024-01-29T16:56:50.632Z + + od______1261::ff2d9e058e7bea90a27f41c31078e601 + oai:air.unimi.it:2434/907506 + + + + + od______1261 + + + + + Ensuring tests of conservation interventions build on existing literature + + + + W.J. Sutherland + + + S.T. Alvarez-Castaneda + + + T. Amano + + + R. Ambrosini + + + P. Atkinson + + + J.M. Baxter + + + A.L. Bond + + + P.J. Boon + + + K.L. Buchanan + + + J. Barlow + + + G. Bogliani + + + O.M. Bragg + + + M. Burgman + + + M.W. Cadotte + + + M. Calver + + + S.J. Cooke + + + R.T. Corlett + + + V. Devictor + + + J.G. Ewen + + + M. Fisher + + + G. Freeman + + + E. Game + + + B.J. Godley + + + C. Gortazar + + + I.R. Hartley + + + D.L. Hawksworth + + + K.A. Hobson + + + M.-. Lu + + + B. Martin-Lopez + + + K. Ma + + + A. Machado + + + D. Mae + + + M. Mangiacotti + + + D.J. Mccafferty + + + V. Melfi + + + S. Molur + + + A.J. Moore + + + S.D. Murphy + + + D. Norri + + + A.P.E. van Oudenhoven + + + J. Power + + + E.C. Ree + + + M.W. Schwartz + + + I. Storch + + + C. Wordley + + + + + + 2020 + 2020 + 2022-06-20 + + eng + Wiley Blackwell Publishing + journal article + application/pdf + 2434/907506 + open access + + Conservation of Natural Resources + + + + + 191802 bytes + + https://air.unimi.it/bitstream/2434/907506/4/Full%20manuscript%20resubmitted.pdf + + 10.1111/cobi.13555 + 32779884 + https://air.unimi.it/bitstream/2434/907506/4/Full%20manuscript%20resubmitted.pdf + 0001 + 2020-01-01 + OPEN + eng + + + + \ No newline at end of file diff --git a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java index de69795f8..ef6370bf3 100644 --- a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java +++ b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java @@ -244,4 +244,27 @@ public class XmlRecordFactoryTest { } + @Test + public void testIrisGuidelines4() throws DocumentException, IOException { + final ContextMapper contextMapper = new ContextMapper(); + + final XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false, + XmlConverterJob.schemaLocation); + + final Publication p = OBJECT_MAPPER + .readValue( + IOUtils.toString(getClass().getResourceAsStream("iris-odf-4.json")), + Publication.class); + + final String xml = xmlRecordFactory.build(new JoinedEntity<>(p)); + + assertNotNull(xml); + + final Document doc = new SAXReader().read(new StringReader(xml)); + + assertNotNull(doc); + System.out.println(doc.asXML()); + + } + } diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/iris-odf-4.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/iris-odf-4.json new file mode 100644 index 000000000..4c5ec9708 --- /dev/null +++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/iris-odf-4.json @@ -0,0 +1 @@ +{"collectedfrom":[{"key":"10|opendoar____::17326d10d511828f6b34fa6d751739e2","value":"Archivio Istituzionale della Ricerca dell'Università degli Studi di Milano","dataInfo":null}],"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}},"lastupdatetimestamp":1706638577436,"id":"50|od______1261::ff2d9e058e7bea90a27f41c31078e601","originalId":["oai:air.unimi.it:2434/907506","50|od______1261::ff2d9e058e7bea90a27f41c31078e601"],"pid":[{"value":"2434/907506","qualifier":{"classid":"handle","classname":"Handle","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"dateofcollection":"","dateoftransformation":"2024-01-29T16:56:50.632Z","extraInfo":[],"oaiprovenance":null,"measures":null,"processingchargeamount":null,"processingchargecurrency":null,"author":[{"fullname":"W.J. Sutherland","name":"W. J.","surname":"Sutherland","rank":1,"pid":[],"affiliation":[]},{"fullname":"S.T. Alvarez-Castaneda","name":"S. T.","surname":"Alvarez-Castaneda","rank":2,"pid":[],"affiliation":[]},{"fullname":"T. Amano","name":"T.","surname":"Amano","rank":3,"pid":[],"affiliation":[]},{"fullname":"R. Ambrosini","name":"R.","surname":"Ambrosini","rank":4,"pid":[],"affiliation":[]},{"fullname":"P. Atkinson","name":"P.","surname":"Atkinson","rank":5,"pid":[],"affiliation":[]},{"fullname":"J.M. Baxter","name":"J. M.","surname":"Baxter","rank":6,"pid":[],"affiliation":[]},{"fullname":"A.L. Bond","name":"A. L.","surname":"Bond","rank":7,"pid":[],"affiliation":[]},{"fullname":"P.J. Boon","name":"P. J.","surname":"Boon","rank":8,"pid":[],"affiliation":[]},{"fullname":"K.L. Buchanan","name":"K. L.","surname":"Buchanan","rank":9,"pid":[],"affiliation":[]},{"fullname":"J. Barlow","name":"J.","surname":"Barlow","rank":10,"pid":[],"affiliation":[]},{"fullname":"G. Bogliani","name":"G.","surname":"Bogliani","rank":11,"pid":[],"affiliation":[]},{"fullname":"O.M. Bragg","name":"O. M.","surname":"Bragg","rank":12,"pid":[],"affiliation":[]},{"fullname":"M. Burgman","name":"M.","surname":"Burgman","rank":13,"pid":[],"affiliation":[]},{"fullname":"M.W. Cadotte","name":"M. W.","surname":"Cadotte","rank":14,"pid":[],"affiliation":[]},{"fullname":"M. Calver","name":"M.","surname":"Calver","rank":15,"pid":[],"affiliation":[]},{"fullname":"S.J. Cooke","name":"S. J.","surname":"Cooke","rank":16,"pid":[],"affiliation":[]},{"fullname":"R.T. Corlett","name":"R. T.","surname":"Corlett","rank":17,"pid":[],"affiliation":[]},{"fullname":"V. Devictor","name":"V.","surname":"Devictor","rank":18,"pid":[],"affiliation":[]},{"fullname":"J.G. Ewen","name":"J. G.","surname":"Ewen","rank":19,"pid":[],"affiliation":[]},{"fullname":"M. Fisher","name":"M.","surname":"Fisher","rank":20,"pid":[],"affiliation":[]},{"fullname":"G. Freeman","name":"G.","surname":"Freeman","rank":21,"pid":[],"affiliation":[]},{"fullname":"E. Game","name":"E.","surname":"Game","rank":22,"pid":[],"affiliation":[]},{"fullname":"B.J. Godley","name":"B. J.","surname":"Godley","rank":23,"pid":[],"affiliation":[]},{"fullname":"C. Gortazar","name":"C.","surname":"Gortazar","rank":24,"pid":[],"affiliation":[]},{"fullname":"I.R. Hartley","name":"I. R.","surname":"Hartley","rank":25,"pid":[],"affiliation":[]},{"fullname":"D.L. Hawksworth","name":"D. L.","surname":"Hawksworth","rank":26,"pid":[],"affiliation":[]},{"fullname":"K.A. Hobson","name":"K. A.","surname":"Hobson","rank":27,"pid":[],"affiliation":[]},{"fullname":"M.-. Lu","name":"M. -.","surname":"Lu","rank":28,"pid":[],"affiliation":[]},{"fullname":"B. Martin-Lopez","name":"B.","surname":"Martin-Lopez","rank":29,"pid":[],"affiliation":[]},{"fullname":"K. Ma","name":"K.","surname":"Ma","rank":30,"pid":[],"affiliation":[]},{"fullname":"A. Machado","name":"A.","surname":"Machado","rank":31,"pid":[],"affiliation":[]},{"fullname":"D. Mae","name":"D.","surname":"Mae","rank":32,"pid":[],"affiliation":[]},{"fullname":"M. Mangiacotti","name":"M.","surname":"Mangiacotti","rank":33,"pid":[],"affiliation":[]},{"fullname":"D.J. Mccafferty","name":"D. J.","surname":"Mccafferty","rank":34,"pid":[],"affiliation":[]},{"fullname":"V. Melfi","name":"V.","surname":"Melfi","rank":35,"pid":[],"affiliation":[]},{"fullname":"S. Molur","name":"S.","surname":"Molur","rank":36,"pid":[],"affiliation":[]},{"fullname":"A.J. Moore","name":"A. J.","surname":"Moore","rank":37,"pid":[],"affiliation":[]},{"fullname":"S.D. Murphy","name":"S. D.","surname":"Murphy","rank":38,"pid":[],"affiliation":[]},{"fullname":"D. Norri","name":"D.","surname":"Norri","rank":39,"pid":[],"affiliation":[]},{"fullname":"A.P.E. van Oudenhoven","name":"A. P. E.","surname":"Oudenhoven","rank":40,"pid":[],"affiliation":[]},{"fullname":"J. Power","name":"J.","surname":"Power","rank":41,"pid":[],"affiliation":[]},{"fullname":"E.C. Ree","name":"E. C.","surname":"Ree","rank":42,"pid":[],"affiliation":[]},{"fullname":"M.W. Schwartz","name":"M. W.","surname":"Schwartz","rank":43,"pid":[],"affiliation":[]},{"fullname":"I. Storch","name":"I.","surname":"Storch","rank":44,"pid":[],"affiliation":[]},{"fullname":"C. Wordley","name":"C.","surname":"Wordley","rank":45,"pid":[],"affiliation":[]}],"resulttype":{"classid":"publication","classname":"publication","schemeid":"dnet:result_typologies","schemename":"dnet:result_typologies"},"metaResourceType":null,"language":{"classid":"eng","classname":"English","schemeid":"dnet:languages","schemename":"dnet:languages"},"country":[],"subject":[{"value":"Conservation of Natural Resources","qualifier":{"classid":"","classname":"","schemeid":"","schemename":""},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"title":[{"value":"Ensuring tests of conservation interventions build on existing literature","qualifier":{"classid":"main title","classname":"main title","schemeid":"dnet:dataCite_title","schemename":"dnet:dataCite_title"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"relevantdate":[{"value":"2020","qualifier":{"classid":"Accepted","classname":"Accepted","schemeid":"dnet:dataCite_date","schemename":"dnet:dataCite_date"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}},{"value":"2020","qualifier":{"classid":"Issued","classname":"Issued","schemeid":"dnet:dataCite_date","schemename":"dnet:dataCite_date"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}},{"value":"2022-06-20","qualifier":{"classid":"Available","classname":"Available","schemeid":"dnet:dataCite_date","schemename":"dnet:dataCite_date"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"description":[],"dateofacceptance":{"value":"2020-01-01","dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}},"publisher":{"value":"Wiley Blackwell Publishing","dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}},"embargoenddate":null,"source":[],"fulltext":[{"value":"https://air.unimi.it/bitstream/2434/907506/4/Full%20manuscript%20resubmitted.pdf","dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"format":[{"value":"application/pdf","dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"contributor":[],"resourcetype":{"classid":"journal article","classname":"journal article","schemeid":"dnet:dataCite_resource","schemename":"dnet:dataCite_resource"},"coverage":[],"bestaccessright":{"classid":"OPEN","classname":"Open Access","schemeid":"dnet:access_modes","schemename":"dnet:access_modes"},"context":[],"externalReference":[],"instance":[{"license":null,"accessright":{"classid":"OPEN","classname":"Open Access","schemeid":"dnet:access_modes","schemename":"dnet:access_modes","openAccessRoute":null},"instancetype":{"classid":"0001","classname":"Article","schemeid":"dnet:publication_resource","schemename":"dnet:publication_resource"},"instanceTypeMapping":[{"originalType":"http://purl.org/coar/resource_type/c_6501","typeCode":null,"typeLabel":null,"vocabularyName":"openaire::coar_resource_types_3_1"}],"hostedby":{"key":"10|opendoar____::17326d10d511828f6b34fa6d751739e2","value":"Archivio Istituzionale della Ricerca dell'Università degli Studi di Milano","dataInfo":null},"url":["https://hdl.handle.net/2434/907506","https://doi.org/10.1111/cobi.13555"],"distributionlocation":null,"collectedfrom":{"key":"10|opendoar____::17326d10d511828f6b34fa6d751739e2","value":"Archivio Istituzionale della Ricerca dell'Università degli Studi di Milano","dataInfo":null},"pid":[{"value":"2434/907506","qualifier":{"classid":"handle","classname":"Handle","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"alternateIdentifier":[{"value":"32779884","qualifier":{"classid":"pmid","classname":"pmid","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}},{"value":"10.1111/cobi.13555","qualifier":{"classid":"doi","classname":"doi","schemeid":"dnet:pid_types","schemename":"dnet:pid_types"},"dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}}],"dateofacceptance":{"value":"2020-01-01","dataInfo":{"invisible":false,"inferred":false,"deletedbyinference":false,"trust":"0.9","inferenceprovenance":null,"provenanceaction":{"classid":"sysimport:crosswalk:repository","classname":"sysimport:crosswalk:repository","schemeid":"dnet:provenanceActions","schemename":"dnet:provenanceActions"}}},"processingchargeamount":null,"processingchargecurrency":null,"refereed":{"classid":"","classname":"","schemeid":"dnet:review_levels","schemename":"dnet:review_levels"},"measures":null,"fulltext":"https://air.unimi.it/bitstream/2434/907506/4/Full%20manuscript%20resubmitted.pdf"}],"eoscifguidelines":[],"openAccessColor":null,"publiclyFunded":null,"journal":null,"isGreen":null,"isInDiamondJournal":null}