diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java index aae28c5..06b3e45 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java @@ -1,6 +1,7 @@ package eu.dnetlib.ariadneplus.elasticsearch; import eu.dnetlib.ariadneplus.elasticsearch.model.AriadnePlusEntry; +import eu.dnetlib.ariadneplus.elasticsearch.model.AriadneResource; import eu.dnetlib.ariadneplus.elasticsearch.model.Spatial; import eu.dnetlib.ariadneplus.reader.ResourceManager; import org.apache.commons.lang3.StringUtils; @@ -64,6 +65,11 @@ public class BulkUpload { try { Object next = manager.next(); AriadnePlusEntry ace = ((AriadnePlusEntry) next); + AriadneResource uri = new AriadneResource(); + uri.setUri(ace.getTypeURI()); + uri.setLabel(ace.getTypeLabel()); + ace.setHas_type(uri); + if (isCollection) { ace.setResourceType("collection"); if (ace.getSpatial()!=null) { 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 d3be760..00acbc0 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 @@ -24,9 +24,9 @@ public class AriadnePlusEntry { private String originalId; private List owner; private List publisher; - private AriadneURI is_about; + private List is_about; private String resourceType; - private AriadneURI has_type; + private AriadneResource has_type; private List responsible; private List spatial; private List temporal; @@ -36,6 +36,8 @@ public class AriadnePlusEntry { private DigitalImage digitalImage; private transient String uniqueIsPartOf; + private transient String typeURI; + private transient String typeLabel; public List getContributor() { return contributor; @@ -212,11 +214,7 @@ public class AriadnePlusEntry { this.description = description; } - public void setIs_about(AriadneURI is_about) { - this.is_about = is_about; - } - - public void setHas_type(AriadneURI has_type) { + public void setHas_type(AriadneResource has_type) { this.has_type = has_type; } @@ -244,11 +242,7 @@ public class AriadnePlusEntry { return description; } - public AriadneURI getIs_about() { - return is_about; - } - - public AriadneURI getHas_type() { + public AriadneResource getHas_type() { return has_type; } @@ -284,6 +278,30 @@ public class AriadnePlusEntry { this.nativePeriod = nativePeriod; } + public String getTypeURI() { + return typeURI; + } + + public void setTypeURI(String typeURI) { + this.typeURI = typeURI; + } + + public String getTypeLabel() { + return typeLabel; + } + + public void setTypeLabel(String typeLabel) { + this.typeLabel = typeLabel; + } + + public List getIs_about() { + return is_about; + } + + public void setIs_about(List is_about) { + this.is_about = is_about; + } + public String toJson(){ return new Gson().toJson(this); } diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneURI.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneResource.java similarity index 68% rename from dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneURI.java rename to dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneResource.java index c5b67a3..7768efe 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneURI.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneResource.java @@ -2,7 +2,7 @@ package eu.dnetlib.ariadneplus.elasticsearch.model; import com.google.gson.Gson; -public class AriadneURI { +public class AriadneResource { private String label; private String uri; @@ -22,10 +22,10 @@ public class AriadneURI { this.uri = uri; } - public AriadneURI() { + public AriadneResource() { } - public static AriadneURI fromJson(String json){ - return new Gson().fromJson(json, AriadneURI.class); + public static AriadneResource fromJson(String json){ + return new Gson().fromJson(json, AriadneResource.class); } } diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties b/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties index 1f92354..7927ec6 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/application.properties @@ -18,6 +18,21 @@ general.classpath=eu.dnetlib.ariadneplus.elasticsearch.model. type.path=https://www.ariadne-infrastructure.eu/property/rdfType exclude.predicates=["https://www.ariadne-infrastructure.eu/property/resourceType", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "https://www.ariadne-infrastructure.eu/property/rdfType"] class.map.specifications={\ +"AriadneResource": {\ +"class_type": "prototype",\ +"mappings": {\ +"https://www.ariadne-infrastructure.eu/property/aboutURILabel": {\ +"class_field": "Label",\ +"substring": "no",\ +"element_type": "java.lang.String"\ +},\ +"https://www.ariadne-infrastructure.eu/property/aboutURI": {\ +"class_field": "Uri",\ +"substring": "no",\ +"element_type": "java.lang.String"\ +}\ +}\ +},\ "AriadneGeoPoint": {\ "class_type": "prototype",\ "mappings": {\ @@ -226,6 +241,16 @@ class.map.specifications={\ "AriadnePlusEntry": {\ "class_type": "unique",\ "mappings": {\ +"https://www.ariadne-infrastructure.eu/property/typeURI": {\ +"class_field": "TypeURI",\ +"substring": "no",\ +"element_type": "java.lang.String"\ +},\ +"https://www.ariadne-infrastructure.eu/property/typeLabel": {\ +"class_field": "TypeLabel",\ +"substring": "no",\ +"element_type": "java.lang.String"\ +},\ "https://www.ariadne-infrastructure.eu/property/accessPolicy": {\ "class_field": "AccessPolicy",\ "substring": "no",\ @@ -365,7 +390,13 @@ class.map.specifications={\ "class_field": "UniqueIsPartOf",\ "substring": "no",\ "element_type": "java.lang.String"\ +},\ +"https://www.ariadne-infrastructure.eu/property/about": {\ +"class_field": "Is_about",\ +"substring": "no",\ +"external_reference": "AriadneResource"\ }\ }\ }\ -} \ No newline at end of file +} + 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 1165ca3..8953445 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 @@ -71,6 +71,11 @@ CONSTRUCT { %record aoprop:archeologicalResourceType ?archeologicalResourceType . ?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName . %record aoprop:resourceType ?resourceType . +%record aoprop:typeURI ?typeURI . +%record aoprop:typeLabel ?typeLabel . +%record aoprop:about ?aboutURI . +?aboutURI aoprop:aboutURI ?aboutURI . +?aboutURI aoprop:aboutURILabel ?aboutLabel . %record aoprop:nativeSubject ?nativeSubject . ?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel . ?nativeSubject aoprop:rdfAbout ?nativeSubject . @@ -96,6 +101,12 @@ where { ?creator aocat:has_name ?creatorName . %record aocat:has_title ?title . %record aocat:has_type / skos:prefLabel ?resourceType . + %record aocat:has_type ?typeURI . + ?typeURI skos:prefLabel ?typeLabel . + optional { + %record aocat:is_about ?aboutURI . + ?aboutURI rdfs:label ?aboutLabel . + } optional { %record aocat:has_native_subject ?nativeSubject . ?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel . 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 7ff7eab..1a3d83a 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 @@ -75,6 +75,11 @@ CONSTRUCT { %record aoprop:archeologicalResourceType ?archeologicalResourceType . ?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName . %record aoprop:resourceType ?resourceType . +%record aoprop:typeURI ?typeURI . +%record aoprop:typeLabel ?typeLabel . +%record aoprop:about ?aboutURI . +?aboutURI aoprop:aboutURI ?aboutURI . +?aboutURI aoprop:aboutURILabel ?aboutLabel . %record aoprop:nativeSubject ?nativeSubject . ?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel . ?nativeSubject aoprop:rdfAbout ?nativeSubject . @@ -97,7 +102,13 @@ where { %record aocat:has_creator ?creator . ?creator aocat:has_name ?creatorName . %record aocat:has_title ?title . - %record aocat:has_type / skos:prefLabel ?resourceType . + %record aocat:has_type / skos:prefLabel ?resourceType . + %record aocat:has_type ?typeURI . + ?typeURI skos:prefLabel ?typeLabel . + optional { + %record aocat:is_about ?aboutURI . + ?aboutURI rdfs:label ?aboutLabel . + } optional { ?creator aocat:has_email ?creatorEmail . } 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 d721238..1e29511 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 @@ -241,6 +241,16 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(isRecord, recordId, datasource, collectionId); } + @Test +// @Ignore + public void uploadADSIsAboutTest() throws Exception { + boolean isRecord = true; + String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/DCDF395A-2CC8-3FC2-B9A5-5A924090DF10"; + String datasource = "ads"; + String collectionId = "3"; + readAndIndexTest(isRecord, recordId, datasource, collectionId); + } + private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception { final ClassPathResource resource = new ClassPathResource("application.properties"); Properties appProps = new Properties();