diff --git a/dhp-workflows/dhp-enrichment/src/main/resources/eu/dnetlib/dhp/wf/subworkflows/bulktag/oozie_app/config-default.xml b/dhp-workflows/dhp-enrichment/src/main/resources/eu/dnetlib/dhp/wf/subworkflows/bulktag/oozie_app/config-default.xml index c1675239c..8801aebe4 100644 --- a/dhp-workflows/dhp-enrichment/src/main/resources/eu/dnetlib/dhp/wf/subworkflows/bulktag/oozie_app/config-default.xml +++ b/dhp-workflows/dhp-enrichment/src/main/resources/eu/dnetlib/dhp/wf/subworkflows/bulktag/oozie_app/config-default.xml @@ -59,4 +59,4 @@ partitions 15000 - \ No newline at end of file + 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 3d89b1e34..134948861 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 @@ -1605,7 +1605,8 @@ public class XmlRecordFactory implements Serializable { if (contextMapper != null && !contextMapper.isEmpty() - && MainEntityType.result.toString().equals(type)) { + // && MainEntityType.result.toString().equals(type) + ) { XMLTag document = XMLDoc.newDocument(true).addRoot("contextRoot"); diff --git a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/IndexRecordTransformerTest.java b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/IndexRecordTransformerTest.java index 923a68352..34d04ced9 100644 --- a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/IndexRecordTransformerTest.java +++ b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/IndexRecordTransformerTest.java @@ -14,6 +14,7 @@ import java.util.List; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; +import eu.dnetlib.dhp.schema.oaf.Datasource; import org.apache.commons.io.IOUtils; import org.apache.solr.client.solrj.util.ClientUtils; import org.apache.solr.common.SolrInputDocument; @@ -85,6 +86,36 @@ public class IndexRecordTransformerTest { testRecordTransformation(xmlRecord); } + @Test + public void testDatasourceRecordTransformation() throws IOException, TransformerException, DocumentException { + + final XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false, + PayloadConverterJob.schemaLocation); + + final Datasource d = load("datasource.json", Datasource.class); + + final JoinedEntity je = new JoinedEntity(d); + je + .setLinks( + Lists + .newArrayList() + ); + + final String xmlRecord = xmlRecordFactory.build(je); + + assertNotNull(xmlRecord); + + System.out.println(xmlRecord); + + Document doc = new SAXReader().read(new StringReader(xmlRecord)); + + System.out.println("CONTEXT " + doc.valueOf( "//*[local-name()='datasource']//*[local-name()='context']")); + + Assertions.assertEquals(0, doc.valueOf( "//*[local-name()='datasource']//*[local-name()='context']").length()); + + //testRecordTransformation(xmlRecord); + } + @Test void testPeerReviewed() throws IOException, TransformerException { diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/datasource.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/datasource.json index ce6b10826..f40def608 100644 --- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/datasource.json +++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/datasource.json @@ -41,6 +41,26 @@ "schemeid": "dnet:datasource_typologies_ui", "schemename": "dnet:datasource_typologies_ui" }, + "context":[ + { + "id":"netherlands", + "dataInfo":[ + { + "invisible":false, + "inferred":false, + "deletedbyinference":false, + "trust":"0.9", + "inferenceprovenance":"", + "provenanceaction":{ + "classid":"sysimport:crosswalk", + "classname":"sysimport:crosswalk", + "schemeid":"dnet:provenanceActions", + "schemename":"dnet:provenanceActions" + } + } + ] + } + ], "pid": [ { "value": "r3d100010218", 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 index b61e55d1a..69d94dacc 100644 --- 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 @@ -14,6 +14,26 @@ "value": "79a0e", "datainfo": null }, + "context":[ + { + "id":"netherlands", + "dataInfo":[ + { + "invisible":false, + "inferred":false, + "deletedbyinference":false, + "trust":"0.9", + "inferenceprovenance":"", + "provenanceaction":{ + "classid":"sysimport:crosswalk", + "classname":"sysimport:crosswalk", + "schemeid":"dnet:provenanceActions", + "schemename":"dnet:provenanceActions" + } + } + ] + } + ], "acronym": { "value": "79a0e_acronym", "datainfo": null