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 853106cd8..ab956a378 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
@@ -334,6 +334,7 @@ public class MappersTest {
assertValidId(p.getCollectedfrom().get(0).getKey());
System.out.println(p.getTitle().get(0).getValue());
assertTrue(StringUtils.isNotBlank(p.getTitle().get(0).getValue()));
+
}
@Test
diff --git a/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/oaf_claim_crossref.xml b/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/oaf_claim_crossref.xml
index 8f69a5e2d..93349f3c9 100644
--- a/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/oaf_claim_crossref.xml
+++ b/dhp-workflows/dhp-graph-mapper/src/test/resources/eu/dnetlib/dhp/oa/graph/raw/oaf_claim_crossref.xml
@@ -46,6 +46,7 @@
10.1080/23744235.2020.1774644
Infectious Diseases
+ corda__h2020::814530
diff --git a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/CreateRelatedEntitiesJob_phase2.java b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/CreateRelatedEntitiesJob_phase2.java
index f3fbca47d..e2cf58d00 100644
--- a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/CreateRelatedEntitiesJob_phase2.java
+++ b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/CreateRelatedEntitiesJob_phase2.java
@@ -8,7 +8,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
-import eu.dnetlib.dhp.schema.common.ModelConstants;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.spark.SparkConf;
@@ -28,6 +27,7 @@ import eu.dnetlib.dhp.common.HdfsSupport;
import eu.dnetlib.dhp.oa.provision.model.JoinedEntity;
import eu.dnetlib.dhp.oa.provision.model.ProvisionModelSupport;
import eu.dnetlib.dhp.oa.provision.model.RelatedEntityWrapper;
+import eu.dnetlib.dhp.schema.common.ModelConstants;
import eu.dnetlib.dhp.schema.common.ModelSupport;
import eu.dnetlib.dhp.schema.oaf.*;
import scala.Tuple2;
diff --git a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/GraphMappingUtils.java b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/GraphMappingUtils.java
index 74d35bf5e..d2131ef28 100644
--- a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/GraphMappingUtils.java
+++ b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/GraphMappingUtils.java
@@ -14,7 +14,8 @@ public class GraphMappingUtils {
public static final String SEPARATOR = "_";
- public static Set authorPidTypes = Sets.newHashSet(
+ public static Set authorPidTypes = Sets
+ .newHashSet(
ModelConstants.ORCID, ModelConstants.ORCID_PENDING, "magidentifier");
public static String removePrefix(final String s) {
diff --git a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/TemplateFactory.java b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/TemplateFactory.java
index 21b526ab1..173ba326a 100644
--- a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/TemplateFactory.java
+++ b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/TemplateFactory.java
@@ -73,7 +73,9 @@ public class TemplateFactory {
final Collection fields,
final String semanticclass,
final String semantischeme,
- final DataInfo info) {
+ final DataInfo info,
+ final boolean validated,
+ final String validationDate) {
return getTemplate(resources.getRel())
.add("type", type)
.add("objIdentifier", escapeXml(removePrefix(objIdentifier)))
@@ -86,6 +88,8 @@ public class TemplateFactory {
.add(
"provenanceaction",
info.getProvenanceaction() != null ? info.getProvenanceaction().getClassid() : "")
+ .add("validated", validated)
+ .add("validationdate", validationDate)
.render();
}
diff --git a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java
index 9f16e99d8..b0a21c62b 100644
--- a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java
+++ b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java
@@ -1096,7 +1096,8 @@ public class XmlRecordFactory implements Serializable {
final HashSet fields = Sets.newHashSet(mapFields(link, contexts));
return templateFactory
.getRel(
- targetType, rel.getTarget(), fields, rel.getRelClass(), scheme, rel.getDataInfo());
+ targetType, rel.getTarget(), fields, rel.getRelClass(), scheme, rel.getDataInfo(), rel.getValidated(),
+ rel.getValidationDate());
}
private List listChildren(
diff --git a/dhp-workflows/dhp-graph-provision/src/main/resources/eu/dnetlib/dhp/oa/provision/template/rel.st b/dhp-workflows/dhp-graph-provision/src/main/resources/eu/dnetlib/dhp/oa/provision/template/rel.st
index af19ba497..e77a86e1d 100644
--- a/dhp-workflows/dhp-graph-provision/src/main/resources/eu/dnetlib/dhp/oa/provision/template/rel.st
+++ b/dhp-workflows/dhp-graph-provision/src/main/resources/eu/dnetlib/dhp/oa/provision/template/rel.st
@@ -1,4 +1,5 @@
- $objIdentifier$
+$if(validated)$$else$$endif$
+$objIdentifier$
$metadata:{ it | $it$ }$
\ 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 8ae8a55c3..27860ca32 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
@@ -5,22 +5,27 @@ import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.StringReader;
+import java.util.List;
import org.apache.commons.io.IOUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
import eu.dnetlib.dhp.oa.provision.model.JoinedEntity;
+import eu.dnetlib.dhp.oa.provision.model.RelatedEntity;
+import eu.dnetlib.dhp.oa.provision.model.RelatedEntityWrapper;
import eu.dnetlib.dhp.oa.provision.utils.ContextMapper;
import eu.dnetlib.dhp.oa.provision.utils.XmlRecordFactory;
+import eu.dnetlib.dhp.schema.oaf.Project;
import eu.dnetlib.dhp.schema.oaf.Publication;
+import eu.dnetlib.dhp.schema.oaf.Relation;
public class XmlRecordFactoryTest {
@@ -58,4 +63,67 @@ public class XmlRecordFactoryTest {
// TODO add assertions based of values extracted from the XML record
}
+
+ @Test
+ public void testXMLRecordFactoryWithValidatedProject() throws IOException, DocumentException {
+
+ ContextMapper contextMapper = new ContextMapper();
+
+ XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false, XmlConverterJob.schemaLocation,
+ otherDsTypeId);
+
+ Publication p = OBJECT_MAPPER
+ .readValue(IOUtils.toString(getClass().getResourceAsStream("publication.json")), Publication.class);
+ Project pj = OBJECT_MAPPER
+ .readValue(IOUtils.toString(getClass().getResourceAsStream("project.json")), Project.class);
+ Relation rel = OBJECT_MAPPER
+ .readValue(
+ (IOUtils.toString(getClass().getResourceAsStream("relToValidatedProject.json"))), Relation.class);
+ RelatedEntity relatedProject = CreateRelatedEntitiesJob_phase1.asRelatedEntity(pj, Project.class);
+ List links = Lists.newArrayList();
+ RelatedEntityWrapper rew = new RelatedEntityWrapper(rel, relatedProject);
+ links.add(rew);
+ JoinedEntity je = new JoinedEntity<>(p);
+ je.setLinks(links);
+
+ String xml = xmlRecordFactory.build(je);
+
+ assertNotNull(xml);
+
+ Document doc = new SAXReader().read(new StringReader(xml));
+ assertNotNull(doc);
+ System.out.println(doc.asXML());
+ Assertions.assertEquals("2021-01-01", doc.valueOf("//validated/@date"));
+ }
+
+ @Test
+ public void testXMLRecordFactoryWithNonValidatedProject() throws IOException, DocumentException {
+
+ ContextMapper contextMapper = new ContextMapper();
+
+ XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false, XmlConverterJob.schemaLocation,
+ otherDsTypeId);
+
+ Publication p = OBJECT_MAPPER
+ .readValue(IOUtils.toString(getClass().getResourceAsStream("publication.json")), Publication.class);
+ Project pj = OBJECT_MAPPER
+ .readValue(IOUtils.toString(getClass().getResourceAsStream("project.json")), Project.class);
+ Relation rel = OBJECT_MAPPER
+ .readValue((IOUtils.toString(getClass().getResourceAsStream("relToProject.json"))), Relation.class);
+ RelatedEntity relatedProject = CreateRelatedEntitiesJob_phase1.asRelatedEntity(pj, Project.class);
+ List links = Lists.newArrayList();
+ RelatedEntityWrapper rew = new RelatedEntityWrapper(rel, relatedProject);
+ links.add(rew);
+ JoinedEntity je = new JoinedEntity<>(p);
+ je.setLinks(links);
+
+ String xml = xmlRecordFactory.build(je);
+
+ assertNotNull(xml);
+
+ Document doc = new SAXReader().read(new StringReader(xml));
+ assertNotNull(doc);
+ System.out.println(doc.asXML());
+ assertEquals("", doc.valueOf("//rel/validated"));
+ }
}
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/project.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/project.json
new file mode 100644
index 000000000..b61e55d1a
--- /dev/null
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/project.json
@@ -0,0 +1,109 @@
+{
+ "id": "40|corda__h2020::79a0e16c122c9a18eb60e4a5e64b620d",
+ "originalId": [],
+ "pid": [],
+ "dateofcollection": "2020-01-01",
+ "dateoftransformation": "2020-01-01",
+ "extraInfo": [],
+ "oaiprovenance": null,
+ "websiteurl": {
+ "value": "https://web.site",
+ "datainfo": null
+ },
+ "code": {
+ "value": "79a0e",
+ "datainfo": null
+ },
+ "acronym": {
+ "value": "79a0e_acronym",
+ "datainfo": null
+ },
+ "title": {
+ "value": "79a0e_title",
+ "datainfo": null
+ },
+ "startdate": {
+ "value": "2019-02-01",
+ "datainfo": null
+ },
+ "enddate": {
+ "value": "2021-01-09",
+ "datainfo": null
+ },
+ "callidentifier": {
+ "value": "79a0e_callID",
+ "datainfo": null
+ },
+ "keywords": {
+ "value": "",
+ "datainfo": null
+ },
+ "duration": {
+ "value": "",
+ "datainfo": null
+ },
+ "ecsc39": {
+ "value": "true",
+ "datainfo": null
+ },
+ "oamandatepublications": {
+ "value": "true",
+ "datainfo": null
+ },
+ "ecarticle29_3": {
+ "value": "false",
+ "datainfo": null
+ },
+ "optional1": {
+ "value": "",
+ "datainfo": null
+ },
+ "optional2": {
+ "value": "",
+ "datainfo": null
+ },
+ "jsonextrainfo":{
+ "value": "",
+ "datainfo": null
+ },
+ "contactfullname":{
+ "value": "",
+ "datainfo": null
+ },
+ "contactfax": {
+ "value": "",
+ "datainfo": null
+ },
+ "contactphone": {
+ "value": "",
+ "datainfo": null
+ },
+ "contactemail": {
+ "value": "",
+ "datainfo": null
+ },
+ "summary": {
+ "value": "79a0e_description",
+ "datainfo": null
+ },
+ "currency": {
+ "value": "EUR",
+ "datainfo": null
+ },
+ "totalcost": 120000,
+ "fundedamount": 18000,
+ "h2020topiccode": "",
+ "h2020topicdescription": "",
+ "h2020classification": [],
+ "subjects": [
+ {
+ "value": "",
+ "qualifier": null,
+ "datainfo": null
+ }
+ ],
+ "fundingtree": []
+
+}
+
+
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/record.xml b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/record.xml
index a0ca0aa6f..2d6049416 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/record.xml
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/record.xml
@@ -294,6 +294,28 @@
>rcuk________::23feba2a5ca7f6b6016bf3a45180da50
University of Delhi
+
+ true
+ corda_______::30c6b5ab90f30666de1d112fb93d8c77
+ 227878
+
+
+ ec__________::EC::FP7
+ ec__________::EC::FP7::SP2
+ ec__________::EC::FP7::SP2::ERC
+
+ Complex structure and dynamics of collective motion
+ COLLMOT
+
+
+
+ irb_hr______::2330a1d0dac71ffbe15fbcbc807288d4
+ 108-1083570-3635
+
+
+
+ Pentadecapeptide BPC 157 - further investigations
+
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/relToProject.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/relToProject.json
new file mode 100644
index 000000000..b4d975255
--- /dev/null
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/relToProject.json
@@ -0,0 +1,31 @@
+{
+"collectedfrom": [
+{
+"key": "10|opendoar____::eccbc87e4b5ce2fe28308fd9f2a7baf3",
+"value": "AMS Acta",
+"dataInfo": null
+}
+],
+"dataInfo": {
+"invisible": false,
+"inferred": false,
+"deletedbyinference": false,
+"trust": "0.9",
+"inferenceprovenance": "",
+"provenanceaction": {
+"classid": "sysimport:crosswalk:repository",
+"classname": "sysimport:crosswalk:repository",
+"schemeid": "dnet:provenanceActions",
+"schemename": "dnet:provenanceActions"
+}
+},
+"lastupdatetimestamp": 1606898557407,
+"relType": "resultProject",
+"subRelType": "outcome",
+"relClass": "isProducedBy",
+"source": "50|CSC_________::0000ec4dd9df012feaafa77e71a0fb4c",
+"target": "40|corda__h2020::79a0e16c122c9a18eb60e4a5e64b620d",
+"validated": false,
+"validationDate": null,
+"properties": []
+}
\ No newline at end of file
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/relToValidatedProject.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/relToValidatedProject.json
new file mode 100644
index 000000000..0346d7264
--- /dev/null
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/relToValidatedProject.json
@@ -0,0 +1,31 @@
+{
+"collectedfrom": [
+{
+"key": "10|opendoar____::eccbc87e4b5ce2fe28308fd9f2a7baf3",
+"value": "AMS Acta",
+"dataInfo": null
+}
+],
+"dataInfo": {
+"invisible": false,
+"inferred": false,
+"deletedbyinference": false,
+"trust": "0.9",
+"inferenceprovenance": "",
+"provenanceaction": {
+"classid": "sysimport:crosswalk:repository",
+"classname": "sysimport:crosswalk:repository",
+"schemeid": "dnet:provenanceActions",
+"schemename": "dnet:provenanceActions"
+}
+},
+"lastupdatetimestamp": 1606898557407,
+"relType": "resultProject",
+"subRelType": "outcome",
+"relClass": "isProducedBy",
+"source": "50|CSC_________::0000ec4dd9df012feaafa77e71a0fb4c",
+"target": "40|corda__h2020::79a0e16c122c9a18eb60e4a5e64b620d",
+"validated": true,
+"validationDate": "2021-01-01",
+"properties": []
+}
\ No newline at end of file