optimized query for retrieving collection using named graph
This commit is contained in:
parent
698828dcfc
commit
495d617c23
|
@ -68,12 +68,8 @@ CONSTRUCT {
|
|||
%record aoprop:description ?description .
|
||||
%record aoprop:language ?language .
|
||||
}
|
||||
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::aat>
|
||||
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::aatplus>
|
||||
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodo>
|
||||
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodoplus>
|
||||
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId>
|
||||
where {
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId> {
|
||||
%record aocat:has_language / skos:prefLabel ?language .
|
||||
%record aocat:has_original_id ?originalId .
|
||||
optional {
|
||||
|
@ -87,10 +83,6 @@ where {
|
|||
%record aocat:has_native_subject ?nativeSubject .
|
||||
?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel .
|
||||
}
|
||||
optional {
|
||||
%record aocat:has_derived_subject ?derivedSubject .
|
||||
?derivedSubject skos:prefLabel ?derivedSubjectPrefLabel .
|
||||
}
|
||||
optional {
|
||||
?creator aocat:has_email ?creatorEmail .
|
||||
}
|
||||
|
@ -103,21 +95,39 @@ where {
|
|||
optional {
|
||||
%record aocat:has_landing_page / rdfs:label ?landingPage .
|
||||
}
|
||||
}
|
||||
|
||||
graph <https://ariadne-infrastructure.eu/ariadneplus::%datasource::aatplus> {
|
||||
optional {
|
||||
%record aocat:has_derived_subject ?derivedSubject .
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::aat> {
|
||||
?derivedSubject skos:prefLabel ?derivedSubjectPrefLabel .
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
select *
|
||||
where {
|
||||
optional {
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId> {
|
||||
%record aocat:has_temporal_coverage ?temporalNative .
|
||||
?temporalNative aocat:has_native_period / skos:prefLabel ?temporalNativePeriodName .
|
||||
}
|
||||
graph <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodoplus> {
|
||||
optional {
|
||||
?temporalNative aocat:from ?temporalNativeFrom .
|
||||
?temporalNative aocat:until ?temporalNativeUntil .
|
||||
}
|
||||
}
|
||||
}
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::periodoplus> {
|
||||
optional {
|
||||
%record aocat:has_temporal_coverage ?temporal .
|
||||
?temporal aocat:has_period / skos:prefLabel ?temporalPeriodName .
|
||||
?temporal aocat:has_period ?label .
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::periodo> {
|
||||
?label skos:prefLabel ?temporalPeriodName .
|
||||
}
|
||||
optional {
|
||||
?temporal aocat:from ?temporalFrom .
|
||||
?temporal aocat:until ?temporalUntil .
|
||||
|
@ -125,7 +135,9 @@ where {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId> {
|
||||
{
|
||||
select *
|
||||
where {
|
||||
|
@ -156,7 +168,9 @@ where {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
graph <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId> {
|
||||
{
|
||||
select *
|
||||
where {
|
||||
|
@ -182,5 +196,6 @@ where {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIND (lang(?derivedSubjectPrefLabel) as ?aatSubjectsLang)
|
||||
}
|
|
@ -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,17 +52,6 @@ public class GraphDbReaderAndESIndexTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void uploadAMCRGenericTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/722A99AA-3218-3772-8884-9086729A67C5";
|
||||
String datasource = "amcr";
|
||||
String collectionId = "oai";
|
||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void uploadAMCRSiteTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/AMCR/3C7EC936-A7CA-3720-B3DC-413A25754FD4";
|
||||
|
@ -72,7 +61,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";
|
||||
|
@ -82,7 +71,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";
|
||||
|
@ -92,7 +81,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";
|
||||
|
@ -102,7 +91,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";
|
||||
|
@ -112,7 +101,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";
|
||||
|
@ -122,7 +111,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";
|
||||
|
@ -132,7 +121,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";
|
||||
|
@ -142,7 +131,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";
|
||||
|
@ -152,7 +141,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";
|
||||
|
@ -162,7 +151,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";
|
||||
|
@ -175,12 +164,33 @@ public class GraphDbReaderAndESIndexTest {
|
|||
// @Ignore
|
||||
public void uploadSndRockartTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/SHFA/812BFA6D-29AA-3C52-A842-58E9C2AB3D59";
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/SHFA/FED23426-2C68-3BB3-9BBA-24F2077C9C6A";
|
||||
String datasource = "snd";
|
||||
String collectionId = "rockart";
|
||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @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";
|
||||
String datasource = "niam";
|
||||
String collectionId = "amb";
|
||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Ignore
|
||||
public void uploadADS398Test() throws Exception {
|
||||
boolean isRecord = false;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/ADS/AAA81A6D-56F3-341C-BAF0-791C31BC7F73";
|
||||
String datasource = "ads";
|
||||
String collectionId = "398";
|
||||
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();
|
||||
|
@ -216,11 +226,16 @@ public class GraphDbReaderAndESIndexTest {
|
|||
}
|
||||
List<String> recordIds = Arrays.asList(recordId);
|
||||
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||
String report = "";
|
||||
if (isRecord) {
|
||||
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false);
|
||||
report = runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false);
|
||||
}
|
||||
else {
|
||||
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, true);
|
||||
report = runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, true);
|
||||
}
|
||||
System.out.println(report);
|
||||
if (!report.contains("Total errors: 0")) {
|
||||
throw new Exception("Error found - check report value.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue