diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadnePlusEntry.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadnePlusEntry.java index 15cd8a6..048e108 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadnePlusEntry.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadnePlusEntry.java @@ -2,6 +2,7 @@ package eu.dnetlib.ariadneplus.elasticsearch.model; import com.google.gson.Gson; import eu.dnetlib.ariadneplus.reader.utils.ESUtils; +import org.apache.commons.compress.utils.Lists; import java.util.List; @@ -34,6 +35,7 @@ public class AriadnePlusEntry { private List nativePeriod; private String wasCreated; private List digitalImage; + private List otherId; private transient String uniqueIsPartOf; private transient String typeURI; @@ -305,4 +307,15 @@ public class AriadnePlusEntry { public void setPublisher(List publisher) { this.publisher = publisher; } + + public List getOtherId() { + return otherId; + } + + public void setOtherId(String otherId) { + if (this.otherId==null) { + this.otherId = Lists.newArrayList(); + } + this.otherId.add(otherId); + } } \ No newline at end of file diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/ResourceManager.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/ResourceManager.java index 502e80d..c2258fc 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/ResourceManager.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/ResourceManager.java @@ -125,13 +125,21 @@ public class ResourceManager { if (!map.hasExternalReference()){ Method setField = c.getMethod("set" + map.getClass_field(), Class.forName(map.getElement_type())); - if (map.getClass_field().equals("Description")) { + //TODO: the current language seems not to support list of strings + if (map.getClass_field().equals("Description") ) { setField.invoke(class_instance, values.stream().map(value -> { return getFieldValue(value); }).collect(Collectors.joining(" \n"))); } else { - setField.invoke(class_instance, getFieldValue(values.get(0))); + if(map.getClass_field().equals("OtherId")){ + for (Object v : values) { + setField.invoke(class_instance, getFieldValue(v)); + } + } + else { + setField.invoke(class_instance, getFieldValue(values.get(0))); + } } } else{ diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties b/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties index b2c1685..78d79b5 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties @@ -441,6 +441,12 @@ class.map.specifications={\ "substring": "no",\ "element_type": "java.lang.String"\ },\ +"https://www.ariadne-infrastructure.eu/property/otherId": {\ +"class_field": "OtherId",\ +"class_type": "prototype",\ +"substring": "no",\ +"element_type": "java.lang.String"\ +},\ "https://www.ariadne-infrastructure.eu/property/temporal": {\ "class_field": "Temporal",\ "substring": "no",\ diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql index 8e24f48..797b702 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql @@ -11,6 +11,7 @@ CONSTRUCT { %record aoprop:rdfType "Collection" . %record aoprop:identifier %record . %record aoprop:originalId ?originalId . +%record aoprop:otherId ?otherId . %record aoprop:issued ?issued . %record aoprop:modified ?modified . %record aoprop:created ?created . @@ -99,6 +100,9 @@ where { graph { %record aocat:has_language / skos:prefLabel ?language . %record aocat:has_original_id ?originalId . + optional { + %record aocat:has_identifier ?otherId . + } optional { %record aocat:is_part_of ?partOf . } diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql index 1b8e71c..1da8731 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql @@ -11,6 +11,7 @@ CONSTRUCT { %record aoprop:rdfType "Record" . %record aoprop:identifier %record . %record aoprop:originalId ?originalId . +%record aoprop:otherId ?otherId . %record aoprop:issued ?issued . %record aoprop:modified ?modified . %record aoprop:created ?created . @@ -107,11 +108,13 @@ where { %record aocat:is_part_of ?partOf . %record aocat:has_creator ?creator . ?creator aocat:has_name ?creatorName . - - %record aocat:has_title ?title . + %record aocat:has_title ?title . %record aocat:has_type / skos:prefLabel ?resourceType . %record aocat:has_type ?typeURI . ?typeURI skos:prefLabel ?typeLabel . + optional { + %record aocat:has_identifier ?otherId . + } optional { %record aocat:has_description ?description . } diff --git a/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java b/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java index a5d1083..aee086f 100644 --- a/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java +++ b/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java @@ -76,6 +76,22 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(true, id, datasource, apiId); } + @Test + public void testADS276WithOtherIds() throws Exception { + String id = "https://ariadne-infrastructure.eu/aocat/Resource/HERoNI/A59B2AE2-57BF-337D-BF0D-7DA8B35AECE8"; + String datasource = "ads"; + String apiId = "276"; + readAndIndexTest(true, id, datasource, apiId); + } + + @Test + public void testSNDWithOtherId() throws Exception { + String id = "https://ariadne-infrastructure.eu/aocat/Collection/62D27ED3-20F3-355C-A7AD-3F3F4BC7457C"; + String datasource = "snd"; + String apiId = "zip"; + readAndIndexTest(false, id, datasource, apiId); + } + @Test public void testADS() throws Exception {