From 9ce6dbfb3c7e419e9c4f9b2402091c2db87ebede Mon Sep 17 00:00:00 2001 From: Alessia Bardi Date: Wed, 23 Nov 2022 19:23:22 +0100 Subject: [PATCH] queries for HNM and CARARE --- .../ordered_sparql_insert_carare_test.sparql | 288 ++++++++++++++++++ ...rdered_sparql_insert_hnm-collection.sparql | 55 ++++ .../HNM/ordered_sparql_insert_hnm.sparql | 158 +++++++--- 3 files changed, 453 insertions(+), 48 deletions(-) create mode 100644 dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CARARE/ordered_sparql_insert_carare_test.sparql create mode 100644 dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm-collection.sparql diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CARARE/ordered_sparql_insert_carare_test.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CARARE/ordered_sparql_insert_carare_test.sparql new file mode 100644 index 0000000..d7b18bf --- /dev/null +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/CARARE/ordered_sparql_insert_carare_test.sparql @@ -0,0 +1,288 @@ +PREFIX aocat: +PREFIX skos: +INSERT { + GRAPH { + ?s aocat:has_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 . + } + } +}; + +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 aocat:AO_Individual_Data_Resource . + MINUS { + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?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 aocat:AO_Individual_Data_Resource . + MINUS { + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?s aocat:has_responsible ?agent . + } + } +}; + +PREFIX aocat: +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 ?agent . + } + } +}; + +PREFIX aocat: +PREFIX rdf: +PREFIX rdfs: +INSERT { + GRAPH { + ?s aocat:has_creator . + 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_creator ?agent . + } + } +}; + +PREFIX aocat: + PREFIX skos: + PREFIX ariadneplus: + + INSERT { + GRAPH { + ?record aocat:has_publisher ?p . + ?p aocat:has_name ?pname . + } + } + USING + USING + WHERE { + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:is_part_of ?coll . + ?coll aocat:has_publisher ?p . + ?p aocat:has_name ?pname . + MINUS{ + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:has_publisher ?pub . + } + }; + +PREFIX aocat: +PREFIX rdf: + +INSERT { + GRAPH { + ?s aocat:has_native_subject ?ns . + } +} +USING +WHERE { + ?s aocat:is_about ?about . + ?about aocat:has_type ?ns . + ?ns rdf:type aocat:AO_Concept . +}; + +PREFIX aocat: +PREFIX rdf: +PREFIX skos: +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: + PREFIX ariadneplus: + + INSERT { + GRAPH { + ?record aocat:was_modified ?coll_mod . + } + } + USING + USING + WHERE { + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:is_part_of ?coll . + ?coll aocat:was_modified ?coll_mod . + MINUS{ + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:was_modified ?modified . + } + }; + + + +PREFIX aocat: +PREFIX skos: +PREFIX ariadneplus: + +INSERT { + GRAPH { + ?record aocat:was_issued ?coll_iss . + } +} + USING + USING +WHERE { + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:is_part_of ?coll . + ?coll aocat:was_issued ?coll_iss . + MINUS{ + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:was_issued ?issued . + } +}; + +PREFIX dcterms: +INSERT { + GRAPH { + ?periodO ?pred ?o . + ?o ?pred2 ?o2 . + ?o2 ?pred3 ?o3 . + } + } + WHERE { + GRAPH { + ?periodO dcterms:spatial . + ?periodO ?pred ?o . + optional { + ?o ?pred2 ?o2 . + optional { + ?o2 ?pred3 ?o3 . + } + } + } + }; + + 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 time:intervalStartedBy / time:hasDateTimeDescription / time:year ?temporalFrom . + ?periodO time:intervalFinishedBy / time:hasDateTimeDescription / time:year ?temporalUntil . + } + } + } + }; + + PREFIX aocat: + PREFIX skos: + + INSERT { + GRAPH { + ?record aocat:has_derived_subject ?aat . + } + } + USING + USING + WHERE { + { + ?record aocat:has_native_subject ?native_subject . + ?aat_subject skos:closeMatch ?aat . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/HNM/", ucase(strafter(str(?native_subject),"HNM/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_subject) + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?aat_subject skos:exactMatch ?aat . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/HNM/", ucase(strafter(str(?native_subject),"HNM/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_subject) + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?aat_subject skos:broadMatch ?aat . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/HNM/", ucase(strafter(str(?native_subject),"HNM/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_subject) + } + union + { + ?record aocat:has_native_subject ?native_subject . + ?aat_subject skos:narrowMatch ?aat . + bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/HNM/", ucase(strafter(str(?native_subject),"HNM/")))) as ?uppercase_native_subject) + filter(?uppercase_native_subject=?aat_subject) + } + }; \ No newline at end of file diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm-collection.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm-collection.sparql new file mode 100644 index 0000000..b863dd6 --- /dev/null +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm-collection.sparql @@ -0,0 +1,55 @@ +PREFIX aocat: +PREFIX skos: +PREFIX rdf: +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: +INSERT { + GRAPH { + ?s aocat:was_modified ?created + } + } + WHERE { + GRAPH { + ?s rdf:type . + ?s aocat:was_created_on ?created + MINUS { + ?s rdf:type . + ?s aocat:was_modified ?modified + } + } +}; + +PREFIX aocat: +PREFIX rdf: +INSERT { + GRAPH { + ?s aocat:was_issued ?created + } + } + WHERE { + GRAPH { + ?s rdf:type . + ?s aocat:was_created_on ?created + MINUS { + ?s rdf:type . + ?s aocat:was_issued ?modified + } + } +}; \ No newline at end of file diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm.sparql index ecf7496..d7b18bf 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm.sparql +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/enrich/HNM/ordered_sparql_insert_hnm.sparql @@ -1,45 +1,21 @@ PREFIX aocat: -PREFIX rdf: -PREFIX rdfs: +PREFIX skos: INSERT { GRAPH { - ?s aocat:has_temporal_coverage . - rdf:type . - rdfs:label "Not provided" . - + ?s aocat:has_type . + skos:prefLabel "provided record" . } } WHERE { GRAPH { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . MINUS { - ?s rdf:type . - ?s aocat:has_temporal_coverage ?tc . + ?s rdf:type aocat:AO_Individual_Data_Resource . + ?s aocat:has_type . } } }; -PREFIX aocat: -PREFIX skos: -PREFIX rdf: -PREFIX rdfs: -INSERT { - GRAPH { - ?s aocat:has_type . - rdf:type . - skos:prefLabel "Dataset Collection" - } - } - WHERE { - GRAPH { - ?s rdf:type . - MINUS { - ?s rdf:type . - ?s aocat:has_type ?t . - } - } -}; - PREFIX aocat: PREFIX rdf: PREFIX rdfs: @@ -53,9 +29,9 @@ INSERT { } WHERE { GRAPH { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . MINUS { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . ?s aocat:has_owner ?agent . } } @@ -74,9 +50,9 @@ INSERT { } WHERE { GRAPH { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . MINUS { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . ?s aocat:has_responsible ?agent . } } @@ -95,9 +71,9 @@ INSERT { } WHERE { GRAPH { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . MINUS { - ?s rdf:type . + ?s rdf:type aocat:AO_Individual_Data_Resource . ?s aocat:has_contributor ?agent . } } @@ -108,22 +84,45 @@ PREFIX rdf: PREFIX rdfs: INSERT { GRAPH { - ?s aocat:has_creator . - rdf:type . - rdfs:label "Not provided" . - aocat:has_name "Not provided" . + ?s aocat:has_creator . + 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_creator ?agent . } } - WHERE { - GRAPH { - ?s rdf:type . - MINUS { - ?s rdf:type . - ?s aocat:has_creator ?agent . - } - } }; +PREFIX aocat: + PREFIX skos: + PREFIX ariadneplus: + + INSERT { + GRAPH { + ?record aocat:has_publisher ?p . + ?p aocat:has_name ?pname . + } + } + USING + USING + WHERE { + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:is_part_of ?coll . + ?coll aocat:has_publisher ?p . + ?p aocat:has_name ?pname . + MINUS{ + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:has_publisher ?pub . + } + }; + PREFIX aocat: PREFIX rdf: @@ -139,6 +138,69 @@ WHERE { ?ns rdf:type aocat:AO_Concept . }; +PREFIX aocat: +PREFIX rdf: +PREFIX skos: +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: + PREFIX ariadneplus: + + INSERT { + GRAPH { + ?record aocat:was_modified ?coll_mod . + } + } + USING + USING + WHERE { + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:is_part_of ?coll . + ?coll aocat:was_modified ?coll_mod . + MINUS{ + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:was_modified ?modified . + } + }; + + + +PREFIX aocat: +PREFIX skos: +PREFIX ariadneplus: + +INSERT { + GRAPH { + ?record aocat:was_issued ?coll_iss . + } +} + USING + USING +WHERE { + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:is_part_of ?coll . + ?coll aocat:was_issued ?coll_iss . + MINUS{ + ?record rdf:type aocat:AO_Individual_Data_Resource . + ?record aocat:was_issued ?issued . + } +}; + PREFIX dcterms: INSERT { GRAPH {