From 59532b0919acd5682c0b249280c8d2a7448c742f Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 11 Jan 2021 17:15:18 +0100 Subject: [PATCH] [#6281 Provenance of product PIDs] Added PIDs to the Instance type; extended mapping for OAF/ODF records --- .../main/java/eu/dnetlib/dhp/schema/oaf/Instance.java | 10 ++++++++++ .../eu/dnetlib/dhp/oa/graph/raw/OafToOafMapper.java | 1 + .../java/eu/dnetlib/dhp/oa/graph/raw/MappersTest.java | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Instance.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Instance.java index edf424aa8..aae5695df 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Instance.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Instance.java @@ -21,6 +21,8 @@ public class Instance implements Serializable { private KeyValue collectedfrom; + private List pid; + private Field dateofacceptance; // ( article | book ) processing charges. Defined here to cope with possible wrongly typed @@ -89,6 +91,14 @@ public class Instance implements Serializable { this.collectedfrom = collectedfrom; } + public List getPid() { + return pid; + } + + public void setPid(List pid) { + this.pid = pid; + } + public Field getDateofacceptance() { return dateofacceptance; } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/raw/OafToOafMapper.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/raw/OafToOafMapper.java index 48219be97..ccb3d6caf 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/raw/OafToOafMapper.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/raw/OafToOafMapper.java @@ -125,6 +125,7 @@ public class OafToOafMapper extends AbstractMdRecordToOafMapper { .setInstancetype(prepareQualifier(doc, "//dr:CobjCategory", DNET_PUBLICATION_RESOURCE)); instance.setCollectedfrom(collectedfrom); instance.setHostedby(hostedby); + instance.setPid(prepareResultPids(doc, info)); instance.setDateofacceptance(field(doc.valueOf("//oaf:dateAccepted"), info)); instance.setDistributionlocation(doc.valueOf("//oaf:distributionlocation")); instance 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 89ef7ed0e..37d5bf33b 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 @@ -122,6 +122,10 @@ public class MappersTest { assertEquals("OPEN", i.getAccessright().getClassid()); }); assertEquals("0001", p.getInstance().get(0).getRefereed().getClassid()); + assertNotNull(p.getInstance().get(0).getPid()); + assertTrue(p.getInstance().get(0).getPid().size() == 1); + assertEquals("doi", p.getInstance().get(0).getPid().get(0).getQualifier().getClassid()); + assertEquals("10.3897/oneeco.2.e13718", p.getInstance().get(0).getPid().get(0).getValue()); assertNotNull(p.getBestaccessright()); assertEquals("OPEN", p.getBestaccessright().getClassid()); @@ -234,6 +238,10 @@ public class MappersTest { assertEquals("OPEN", i.getAccessright().getClassid()); }); assertEquals("0001", d.getInstance().get(0).getRefereed().getClassid()); + assertNotNull(d.getInstance().get(0).getPid()); + assertTrue(d.getInstance().get(0).getPid().size() == 1); + assertEquals("doi", d.getInstance().get(0).getPid().get(0).getQualifier().getClassid()); + assertEquals("10.5281/zenodo.3234526", d.getInstance().get(0).getPid().get(0).getValue()); assertValidId(r1.getSource()); assertValidId(r1.getTarget());