diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/RunSPARQLQueryService.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/RunSPARQLQueryService.java
index b1b730c..6ddd598 100644
--- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/RunSPARQLQueryService.java
+++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/reader/RunSPARQLQueryService.java
@@ -47,6 +47,11 @@ public class RunSPARQLQueryService {
setGraphDBRepository(graphDbRepository);
}
+ public void setupReadOnlyConnection(String graphDbUrl, String graphDbRepository) {
+ setGraphDBUrl(graphDbUrl);
+ setGraphDBRepository(graphDbRepository);
+ }
+
private void openConnection(){
manager = new RemoteRepositoryManager(getGraphDBUrl());
manager.init();
diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql
index 0411ea4..da98838 100644
--- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql
+++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql
@@ -7,97 +7,97 @@ PREFIX ariadneplus:
PREFIX time:
CONSTRUCT {
-%record aoprop:rdfType "Record" .
-%record aoprop:identifier %record .
-%record aoprop:originalId ?originalId .
-%record aoprop:issued ?issued .
-%record aoprop:modified ?modified .
-%record aoprop:partOf ?partOf .
-%record aoprop:creator ?creator .
+ aoprop:rdfType "Record" .
+ aoprop:identifier .
+ aoprop:originalId ?originalId .
+ aoprop:issued ?issued .
+ aoprop:modified ?modified .
+ aoprop:partOf ?partOf .
+ aoprop:creator ?creator .
?creator aoprop:name ?creatorName .
?creator aoprop:email ?creatorEmail .
-%record aoprop:contributor ?contributor .
+ aoprop:contributor ?contributor .
?contributor aoprop:name ?contributorName .
?contributor aoprop:email ?contributorEmail .
-%record aoprop:legalResponsible ?legalResponsible .
+ aoprop:legalResponsible ?legalResponsible .
?legalResponsible aoprop:name ?legalResponsibleName .
?legalResponsible aoprop:email ?legalResponsibleEmail .
-%record aoprop:owner ?owner .
+ aoprop:owner ?owner .
?owner aoprop:name ?ownerName .
?owner aoprop:email ?ownerEmail .
-%record aoprop:publisher ?publisher .
+ aoprop:publisher ?publisher .
?publisher aoprop:name ?publisherName .
?publisher aoprop:email ?publisherEmail .
-%record aoprop:accessPolicy ?accessPolicy .
-%record aoprop:accessRights ?accessRights .
-%record aoprop:landingPage ?landingPage .
-%record aoprop:spatialRegion ?spatialRegion .
+ aoprop:accessPolicy ?accessPolicy .
+ aoprop:accessRights ?accessRights .
+ aoprop:landingPage ?landingPage .
+ aoprop:spatialRegion ?spatialRegion .
?spatialRegion aoprop:placeName ?spatialPlaceName .
?spatialRegion aoprop:spatialCoordinateSystem ?spatialCoordinateSystem .
-%record aoprop:spatialRegionPoint ?spatialRegionPoint .
+ aoprop:spatialRegionPoint ?spatialRegionPoint .
?spatialRegionPoint aoprop:lat ?spatialLocationLat .
?spatialRegionPoint aoprop:lon ?spatialLocationLon .
-%record aoprop:spatialRegionBox ?spatialRegionBox .
+ aoprop:spatialRegionBox ?spatialRegionBox .
?spatialRegionBox aoprop:boxMaxLat ?spatialLocationBBMaxLat .
?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon .
?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat .
?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon .
-%record aoprop:temporal ?temporal .
+ aoprop:temporal ?temporal .
?temporal aoprop:periodOName ?temporalPeriodName .
?temporal aoprop:from ?temporalFrom .
?temporal aoprop:until ?temporalUntil .
?temporal aoprop:uri ?temporal .
-%record aoprop:temporal ?temporalNative .
+ aoprop:temporal ?temporalNative .
?temporalNative aoprop:nativePeriodName ?temporalNativePeriodName .
?temporalNative aoprop:from ?temporalNativeFrom .
?temporalNative aoprop:until ?temporalNativeUntil .
-%record aoprop:archeologicalResourceType ?archeologicalResourceType .
+ aoprop:archeologicalResourceType ?archeologicalResourceType .
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
-%record aoprop:resourceType ?resourceType .
-%record aoprop:nativeSubject ?nativeSubject .
+ aoprop:resourceType ?resourceType .
+ aoprop:nativeSubject ?nativeSubject .
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
?nativeSubject aoprop:rdfAbout ?nativeSubject .
-%record aoprop:derivedSubject ?derivedSubject .
+ aoprop:derivedSubject ?derivedSubject .
?derivedSubject aoprop:prefLabel ?derivedSubjectPrefLabel .
?derivedSubject aoprop:source "Getty AAT" .
-%record aoprop:aatSubjects ?derivedSubject .
+ aoprop:aatSubjects ?derivedSubject .
?derivedSubject aoprop:id ?derivedSubject .
?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
?derivedSubject aoprop:lang ?aatSubjectsLang .
-%record aoprop:title ?title .
-%record aoprop:description ?description .
-%record aoprop:language ?language .
+ aoprop:title ?title .
+ aoprop:description ?description .
+ aoprop:language ?language .
}
where {
- graph {
- %record aocat:has_language / skos:prefLabel ?language .
- %record aocat:has_original_id ?originalId .
- %record aocat:is_part_of ?partOf .
- %record aocat:has_creator ?creator .
+ graph {
+ aocat:has_language / skos:prefLabel ?language .
+ aocat:has_original_id ?originalId .
+ aocat:is_part_of ?partOf .
+ aocat:has_creator ?creator .
?creator aocat:has_name ?creatorName .
- %record aocat:has_title ?title .
- %record aocat:has_type / skos:prefLabel ?resourceType .
+ aocat:has_title ?title .
+ aocat:has_type / skos:prefLabel ?resourceType .
optional {
?creator aocat:has_email ?creatorEmail .
}
optional {
- %record aocat:has_description ?description .
+ aocat:has_description ?description .
}
optional {
- %record aocat:has_access_policy / rdfs:label ?accessPolicy .
+ aocat:has_access_policy / rdfs:label ?accessPolicy .
}
optional {
- %record aocat:has_landing_page / rdfs:label ?landingPage .
+ aocat:has_landing_page / rdfs:label ?landingPage .
}
}
optional {
- graph {
- %record aocat:has_temporal_coverage ?temporalNative .
+ graph {
+ aocat:has_temporal_coverage ?temporalNative .
?temporalNative aocat:has_native_period ?nativeLabel .
?nativeLabel skos:prefLabel ?temporalNativePeriodName .
}
- graph {
+ graph {
optional {
?temporalNative aocat:from ?temporalNativeFrom .
?temporalNative aocat:until ?temporalNativeUntil .
@@ -107,12 +107,12 @@ where {
optional {
- graph {
- %record aocat:has_temporal_coverage ?temporal .
+ graph {
+ aocat:has_temporal_coverage ?temporal .
}
- graph {
+ graph {
?temporal aocat:has_period ?label .
- graph {
+ graph {
?label skos:prefLabel ?temporalPeriodName .
}
optional {
@@ -122,22 +122,22 @@ where {
}
}
- graph {
+ graph {
{
select *
where {
- %record aocat:was_issued ?issued .
- %record aocat:was_modified ?modified .
- %record aocat:has_contributor ?contributor .
+ aocat:was_issued ?issued .
+ aocat:was_modified ?modified .
+ aocat:has_contributor ?contributor .
?contributor aocat:has_name ?contributorName .
- %record aocat:has_responsible ?legalResponsible .
+ aocat:has_responsible ?legalResponsible .
?legalResponsible aocat:has_name ?legalResponsibleName .
- %record aocat:has_owner ?owner .
+ aocat:has_owner ?owner .
?owner aocat:has_name ?ownerName .
- %record aocat:has_publisher ?publisher .
+ aocat:has_publisher ?publisher .
?publisher aocat:has_name ?publisherName .
- %record aocat:has_access_rights ?accessRights .
- %record aocat:has_ARIADNE_subject ?archeologicalResourceType .
+ aocat:has_access_rights ?accessRights .
+ aocat:has_ARIADNE_subject ?archeologicalResourceType .
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
optional {
?contributor aocat:has_email ?contributorEmail .
@@ -155,23 +155,23 @@ where {
}
}
- graph {
+ graph {
{
select *
where {
- %record aocat:has_spatial_coverage ?spatialRegion .
+ aocat:has_spatial_coverage ?spatialRegion .
?spatialRegion aocat:has_place_name ?spatialPlaceName .
optional {
- %record aocat:has_spatial_coverage ?spatialRegion .
+ aocat:has_spatial_coverage ?spatialRegion .
?spatialRegion aocat:has_coordinate_system ?spatialCoordinateSystem .
}
optional {
- %record aocat:has_spatial_coverage ?spatialRegionPoint .
+ aocat:has_spatial_coverage ?spatialRegionPoint .
?spatialRegionPoint aocat:has_latitude ?spatialLocationLat ;
aocat:has_longitude ?spatialLocationLon .
}
optional {
- %record aocat:has_spatial_coverage ?spatialRegionBox .
+ aocat:has_spatial_coverage ?spatialRegionBox .
?spatialRegionBox aocat:has_bounding_box_max_lat ?spatialLocationBBMaxLat ;
aocat:has_bounding_box_max_lon ?spatialLocationBBMaxLon ;
aocat:has_bounding_box_min_lat ?spatialLocationBBMinLat ;
@@ -181,23 +181,23 @@ where {
}
}
- graph {
+ graph {
{
select *
where {
- %record aocat:has_native_subject ?nativeSubject .
+ aocat:has_native_subject ?nativeSubject .
?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel .
}
}
}
- graph {
+ graph {
{
select *
where {
optional {
- %record aocat:has_derived_subject ?derivedSubject .
- graph {
+ aocat:has_derived_subject ?derivedSubject .
+ graph {
?derivedSubject skos:prefLabel ?derivedSubjectPrefLabel .
}
}
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 adac55a..cfeb275 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
@@ -250,7 +250,7 @@ public class GraphDbReaderAndESIndexTest {
}
@Test
- @Ignore
+ //@Ignore
public void selectRecordsTest() throws Exception {
final ClassPathResource resource = new ClassPathResource("application.properties");
Properties appProps = new Properties();
@@ -258,12 +258,13 @@ public class GraphDbReaderAndESIndexTest {
String datasource = "ads";
String collectionId = "271";
runSPQRLQuery = new RunSPARQLQueryService();
- runSPQRLQuery.setupConnection(
- appProps.getProperty("graphdb.writer.user"),
- appProps.getProperty("graphdb.writer.pwd"),
- appProps.getProperty("repository.url"),
+ runSPQRLQuery.setupReadOnlyConnection(
+ appProps.getProperty("graphdb.serverUrl"),
appProps.getProperty("graphdb.repository"));
- runSPQRLQuery.selectRecordIds(datasource, collectionId);
+ List res = runSPQRLQuery.selectRecordIds(datasource, collectionId);
+ for (String s : res){
+ System.out.println(s);
+ }
}
@Test