From bd44bc6fa544885c659e02570ac6ce11a534318a Mon Sep 17 00:00:00 2001 From: Enrico Ottonello Date: Wed, 26 May 2021 18:50:11 +0200 Subject: [PATCH 1/2] sparql insert for road --- .../ROCEEH/ordered_sparql_insert_road.sparql | 195 ++++++++++++++++++ ...d_sparql_insert_road_collectionInfo.sparql | 39 ++++ .../GraphDbReaderAndESIndexTest.java | 40 ++-- 3 files changed, 259 insertions(+), 15 deletions(-) create mode 100644 dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road.sparql create mode 100644 dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road_collectionInfo.sparql diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road.sparql new file mode 100644 index 0000000..31a9527 --- /dev/null +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road.sparql @@ -0,0 +1,195 @@ +PREFIX aocat: +PREFIX skos: +PREFIX ariadneplus: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?record aocat:has_responsible ?coll_value . + ?coll_value rdf:type ?type . + ?coll_value rdfs:label ?label . + ?coll_value aocat:has_name ?name . + } +} +USING +USING +WHERE { + ?record aocat:is_part_of ?collection . + ?collection aocat:has_responsible ?coll_value . + ?coll_value rdf:type ?type . + ?coll_value rdfs:label ?label . + ?coll_value aocat:has_name ?name . + MINUS { + ?record aocat:has_responsible ?rec_value . + } +}; + + +PREFIX aocat: +PREFIX skos: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?s aocat:has_contributor . + rdf:type . + rdfs:label "Not provided" . + aocat:has_name "Not provided" . + } + } + WHERE { + GRAPH { + ?s rdf:type aocat:AO_Individual_Data_Resource . + MINUS { + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?s aocat:has_contributor ?contributor . + } + } +}; + + +PREFIX aocat: +PREFIX rdf: +PREFIX rdfs: +PREFIX skos: +INSERT { + GRAPH { + ?s aocat:has_type . + rdf:type . + skos:prefLabel "provided record" + } + } + WHERE { + GRAPH { + ?s rdf:type aocat:AO_Individual_Data_Resource . + MINUS { + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?s aocat:has_type ?t . + } + } +}; +PREFIX aocat: +PREFIX skos: +PREFIX ariadneplus: +INSERT { + GRAPH { + ?record aocat:was_issued ?coll_issued_value . + ?record aocat:was_modified ?coll_modified_value . + } +} +USING +USING +WHERE { + ?record aocat:is_part_of ?collection . + ?collection aocat:was_issued ?coll_issued_value . + ?collection aocat:was_modified ?coll_modified_value . + MINUS { + ?record aocat:was_issued ?rec_value . + ?record aocat:was_modified ?rec_value2 . + } +}; + +PREFIX aocat: +PREFIX skos: +PREFIX ariadneplus: +INSERT { + GRAPH { + ?record aocat:has_ARIADNE_subject ?coll_value . + ?coll_value skos:prefLabel ?prefLabelValue . + } +} +USING +USING +WHERE { + ?record aocat:is_part_of ?collection . + ?collection aocat:has_ARIADNE_subject ?coll_value . + ?coll_value skos:prefLabel ?prefLabelValue . + MINUS { + ?record aocat:has_ARIADNE_subject ?rec_value . + } +}; + +PREFIX aocat: +PREFIX skos: +PREFIX rdf: +INSERT { + GRAPH { + ?s aocat:has_native_subject . + skos:prefLabel "Not provided" . + } +} +WHERE { + GRAPH { + ?s rdf:type aocat:AO_Individual_Data_Resource . + MINUS { + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?s aocat:has_native_subject ?ns . + } + } +}; + +PREFIX aocat: +PREFIX skos: + +INSERT { + GRAPH { + ?record aocat:has_derived_subject ?aat_subject . + } +} +USING +USING +WHERE { + { + ?record aocat:has_native_subject ?native_subject . + ?aat_native_subject skos:exactMatch ?aat_subject . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/ROAD/", ucase(strafter(str(?native_subject),"ROAD/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_native_subject) + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?aat_native_subject skos:broadMatch ?aat_subject . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/ROAD/", ucase(strafter(str(?native_subject),"ROAD/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_native_subject) + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?aat_native_subject skos:closeMatch ?aat_subject . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/ROAD/", ucase(strafter(str(?native_subject),"ROAD/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_native_subject) + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?aat_native_subject skos:narrowMatch ?aat_subject . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/ROAD/", ucase(strafter(str(?native_subject),"ROAD/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_native_subject) + } +}; + +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 { + ?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/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road_collectionInfo.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road_collectionInfo.sparql new file mode 100644 index 0000000..21add2d --- /dev/null +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/ROCEEH/ordered_sparql_insert_road_collectionInfo.sparql @@ -0,0 +1,39 @@ +PREFIX aocat: +PREFIX skos: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?s aocat:was_issued "2021-04-23"^^xsd:dateTime . + ?s aocat:was_modified "2021-05-06"^^xsd:dateTime . + } +} +USING +WHERE { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:was_issued ?issued . + ?s aocat:was_modified ?modified . + } +}; + +PREFIX aocat: +PREFIX rdf: +PREFIX skos: +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 . + } + } +}; \ 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 5bb164f..adac55a 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 @@ -32,7 +32,7 @@ public class GraphDbReaderAndESIndexTest { private RunSPARQLQueryService runSPQRLQuery; @Test -// @Ignore + @Ignore public void uploadAMCRFieldworkTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/AMCR/E61E0F4E-268F-39E4-8EDB-A431AFC505AA"; @@ -41,7 +41,7 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(isRecord, recordId, datasource, collectionId); } -// @Test + @Test @Ignore public void uploadAMCRDocumentTest() throws Exception { boolean isRecord = true; @@ -52,6 +52,7 @@ public class GraphDbReaderAndESIndexTest { } @Test + @Ignore public void uploadAMCRSiteTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/AMCR/3C7EC936-A7CA-3720-B3DC-413A25754FD4"; @@ -61,7 +62,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadAMCRIndividualFindTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/AMCR/98D717C4-410F-35C6-8072-FABA7686B4A3"; @@ -71,7 +72,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadADSRecordTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/34E3811A-0BAD-3832-B3A0-3139E8A0285C"; @@ -81,7 +82,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadADSRecordWithNativeFromUntilTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/3C3C7A86-FF09-3431-95B1-B9A4AA8293AF"; @@ -91,7 +92,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadADSRecordWithoutNativeFromUntilTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/DF5F27D3-C877-3F23-9EAA-3776362363AA"; @@ -101,7 +102,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadZbivaRecordSpatialTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/ZRC-SAZU-Zbiva/B34517C6-8D94-3A02-B461-08522F958479"; @@ -111,7 +112,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadHNMCollectionSpatialTest() throws Exception { boolean isRecord = false; String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/HNM/5A7A4257-EE73-31F9-9F74-BADB371555F5"; @@ -121,7 +122,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadHNMCollectionTemporalTest() throws Exception { boolean isRecord = false; String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/HNM/0F1AF07E-CE63-342C-8E95-11FF1C024BD5"; @@ -131,7 +132,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadADSArchivesBoundingBoxTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/90D1C95D-E249-3E74-92D9-B58FDF690CC7"; @@ -141,7 +142,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadDansNoSpatialTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/F100A0AD-6A7F-3976-B77F-FFAB4F5B55DD"; @@ -151,7 +152,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadDansFieldworkReportTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/CA076E46-5CED-322C-B77E-3B90C11B968B"; @@ -161,7 +162,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadSndRockartTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/SHFA/FED23426-2C68-3BB3-9BBA-24F2077C9C6A"; @@ -171,7 +172,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadNIAMTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/NIAM-BAS%2FAKB/D4388BF5-AF3D-3F24-8C2E-2FEAD1255FB1"; @@ -181,7 +182,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadADS398Test() throws Exception { boolean isRecord = false; String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/ADS/AAA81A6D-56F3-341C-BAF0-791C31BC7F73"; @@ -190,6 +191,15 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(isRecord, recordId, datasource, collectionId); } + @Test +// @Ignore + public void uploadROADTest() throws Exception { + boolean isRecord = true; + String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/FC70B370-C489-31C5-B1D4-339CFD28CF2B"; + String datasource = "road"; + String collectionId = "sites"; + 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"); From a9a0526bcf7e46af0401490e0286e4f2f331e3e4 Mon Sep 17 00:00:00 2001 From: Enrico Ottonello Date: Thu, 27 May 2021 22:16:39 +0200 Subject: [PATCH 2/2] sparql insert for pp --- .../enrich/PP/ordered_sparql_insert_pp.sparql | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/PP/ordered_sparql_insert_pp.sparql diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/PP/ordered_sparql_insert_pp.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/PP/ordered_sparql_insert_pp.sparql new file mode 100644 index 0000000..f6f8163 --- /dev/null +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/PP/ordered_sparql_insert_pp.sparql @@ -0,0 +1,60 @@ +PREFIX aocat: +PREFIX skos: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?s aocat:was_modified ?issued . + } +} +USING +WHERE { + ?s rdf:type . + ?s aocat:was_issued ?issued . + MINUS { + ?s rdf:type . + ?s aocat:was_issued ?issued . + ?s aocat:was_modified ?modified . + } +}; + +PREFIX aocat: +PREFIX rdf: +PREFIX skos: +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_temporal_coverage . + rdf:type . + rdfs:label "Not provided" . + + } +} +WHERE { + GRAPH { + ?s rdf:type . + MINUS { + ?s rdf:type . + ?s aocat:has_temporal_coverage ?tc . + } + } +}; \ No newline at end of file