sparql insert for road

This commit is contained in:
Enrico Ottonello 2021-05-26 18:50:11 +02:00
parent 495d617c23
commit bd44bc6fa5
3 changed files with 259 additions and 15 deletions

View File

@ -0,0 +1,195 @@
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?record aocat:has_responsible ?coll_value .
?coll_value rdf:type ?type .
?coll_value rdfs:label ?label .
?coll_value aocat:has_name ?name .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo>
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: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?s aocat:has_contributor <https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> .
<https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Agent> .
<https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> rdfs:label "Not provided" .
<https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> aocat:has_name "Not provided" .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?s rdf:type aocat:AO_Individual_Data_Resource .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_contributor ?contributor .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?s aocat:has_type <https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/provided%20record> .
<https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/provided%20record> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Concept> .
<https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/provided%20record> skos:prefLabel "provided record"
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?s rdf:type aocat:AO_Individual_Data_Resource .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_type ?t .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?record aocat:was_issued ?coll_issued_value .
?record aocat:was_modified ?coll_modified_value .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo>
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: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?record aocat:has_ARIADNE_subject ?coll_value .
?coll_value skos:prefLabel ?prefLabelValue .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo>
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: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?s aocat:has_native_subject <https://ariadne-infrastructure.eu/aocat/Concept/road/NOT_PROVIDED> .
<https://ariadne-infrastructure.eu/aocat/Concept/road/NOT_PROVIDED> skos:prefLabel "Not provided" .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?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: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::road::aatplus> {
?record aocat:has_derived_subject ?aat_subject .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::aat>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites>
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: <http://www.w3.org/2004/02/skos/core#>
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX dcterms: <http://purl.org/dc/terms/>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::road::periodoplus> {
?temporal aocat:has_period ?periodO .
?temporal aocat:from ?temporalFrom .
?temporal aocat:until ?temporalUntil .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::sites> {
?temporal aocat:has_native_period ?native_period .
?native_period skos:prefLabel ?native_label .
optional {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::road::periodo> {
?periodO skos:altLabel ?native_label .
?periodO skos:inScheme <http://n2t.net/ark:/99152/p0s2rwk> .
?periodO time:intervalStartedBy / time:hasDateTimeDescription / time:year ?temporalFrom .
?periodO time:intervalFinishedBy / time:hasDateTimeDescription / time:year ?temporalUntil .
}
}
}
};

View File

@ -0,0 +1,39 @@
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo> {
?s aocat:was_issued "2021-04-23"^^xsd:dateTime .
?s aocat:was_modified "2021-05-06"^^xsd:dateTime .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo>
WHERE {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
MINUS {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
?s aocat:was_issued ?issued .
?s aocat:was_modified ?modified .
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo> {
?s aocat:has_type <https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/collection> .
<https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/collection> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Concept> .
<https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/collection> skos:prefLabel "collection"
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::road::CollectionInfo> {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
MINUS {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
?s aocat:has_type ?t .
}
}
};

View File

@ -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");