From e3c2451e5acd9c595f8d7b866a1faf39a8aeb810 Mon Sep 17 00:00:00 2001 From: Enrico Ottonello Date: Mon, 20 Dec 2021 10:58:43 +0100 Subject: [PATCH] fix cenieh periodo matching --- .../ordered_sparql_insert_cenieh_cir.sparql | 272 ++++++++++++++++++ .../GraphDbReaderAndESIndexTest.java | 10 + 2 files changed, 282 insertions(+) create mode 100644 dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CENIEH/ordered_sparql_insert_cenieh_cir.sparql diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CENIEH/ordered_sparql_insert_cenieh_cir.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CENIEH/ordered_sparql_insert_cenieh_cir.sparql new file mode 100644 index 0000000..2eb9713 --- /dev/null +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CENIEH/ordered_sparql_insert_cenieh_cir.sparql @@ -0,0 +1,272 @@ +PREFIX aocat: + PREFIX skos: + PREFIX rdf: + PREFIX rdfs: + INSERT { + GRAPH { + ?s aocat:has_type . + rdf:type . + skos:prefLabel "collection" + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_type ?t . + } + } + }; + + + PREFIX aocat: + PREFIX rdf: + PREFIX rdfs: + INSERT { + GRAPH { + ?s aocat:has_owner . + rdf:type . + rdfs:label "Not provided" . + aocat:has_name "Not provided" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_owner ?agent . + } + } + }; + + PREFIX aocat: + PREFIX rdf: + PREFIX rdfs: + INSERT { + GRAPH { + ?s aocat:has_responsible . + rdf:type . + rdfs:label "Not provided" . + aocat:has_name "Not provided" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_responsible ?agent . + } + } + }; + + PREFIX aocat: + PREFIX rdf: + INSERT { + GRAPH { + ?s aocat:was_modified "Not provided" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:was_modified ?d . + } + } + }; + + PREFIX aocat: + PREFIX rdf: + INSERT { + GRAPH { + ?s aocat:was_issued "Not provided" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:was_issued ?d . + } + } + }; + + PREFIX aocat: + PREFIX skos: + PREFIX rdf: + INSERT { + GRAPH { + ?s aocat:has_language . + skos:prefLabel "und" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_language ?ns . + } + } + }; + + PREFIX aocat: + PREFIX rdf: + INSERT { + GRAPH { + ?s aocat:has_original_id "CENIEH_CIR" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_original_id ?tc . + } + } + }; + + + PREFIX aocat: + PREFIX skos: + PREFIX rdf: +INSERT { + GRAPH { + ?s aocat:has_creator . + rdf:type . + rdfs:label "Not provided" . + aocat:has_name "Not provided" . + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_creator ?agent . + } + } +}; + + PREFIX aocat: + PREFIX rdf: + PREFIX rdfs: + INSERT { + GRAPH { + ?s aocat:has_temporal_coverage . + rdf:type . + rdfs:label "Not provided" . + + } + } + WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_temporal_coverage ?tc . + } + } + }; + +PREFIX aocat: +PREFIX rdf: +INSERT { + GRAPH { + ?s aocat:has_access_rights "Not provided" . + } +} +WHERE { + GRAPH { + ?s rdf:type aocat:AO_Individual_Data_Resource . + MINUS { + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?s aocat:has_access_rights ?ar . + } + } +}; + + PREFIX aocat: + PREFIX skos: + PREFIX ariadneplus: + + INSERT { + GRAPH { + ?record aocat:has_ARIADNE_subject ?archeologicalResourceType . + ?record aocat:has_owner ?owner . + ?record aocat:has_responsible ?legalResponsible . + ?record aocat:has_contributor ?contributor . + } + } + USING + WHERE { + ?record aocat:is_part_of ?collection . + ?collection aocat:has_ARIADNE_subject ?archeologicalResourceType . + ?collection aocat:has_owner ?owner . + ?collection aocat:has_responsible ?legalResponsible . + ?collection aocat:has_contributor ?contributor . + }; + + PREFIX aocat: + PREFIX skos: + INSERT { + GRAPH { + ?record aocat:has_derived_subject ?aat . + } + } + USING + USING + WHERE { + { + ?record aocat:has_native_subject ?native_subject . + ?native_subject skos:exactMatch ?aat . + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?native_subject skos:broadMatch ?aat . + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?native_subject skos:closeMatch ?aat . + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?native_subject skos:narrowMatch ?aat . + } + }; + + PREFIX skos: + PREFIX aocat: + PREFIX time: + PREFIX dcterms: + INSERT { + GRAPH { + ?temporal aocat:has_period ?periodO . + ?temporal aocat:from ?temporalFrom . + ?temporal aocat:until ?temporalUntil . + } + } + WHERE { + GRAPH { + ?record aocat:has_temporal_coverage ?temporal . + ?temporal aocat:has_native_period ?native_period . + ?native_period skos:prefLabel ?native_label . + optional { + GRAPH { + ?periodO skos:altLabel ?native_label . + ?periodO skos:inScheme . + ?periodO time:intervalStartedBy / time:hasDateTimeDescription / time:year ?temporalFrom . + ?periodO time:intervalFinishedBy / time:hasDateTimeDescription / time:year ?temporalUntil . + } + } + } + }; \ No newline at end of file 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 d7e85aa..2f53d84 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 @@ -381,6 +381,16 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(isRecord, recordId, datasource, collectionId); } + @Test +// @Ignore + public void uploadCeniehTest() throws Exception { + boolean isRecord = true; + String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/0F55399D-8001-36E6-8D52-0C32981CAD7E"; + String datasource = "cenieh"; + String collectionId = "cir"; + 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();