diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql index 44fc7c7..fbe1721 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql +++ b/dnet-ariadneplus-graphdb-publisher/src/main/resources/eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql @@ -5,6 +5,7 @@ PREFIX aoprop: PREFIX onto: PREFIX ariadneplus: PREFIX time: +PREFIX rdf: CONSTRUCT { %record aoprop:rdfType "Collection" . @@ -57,6 +58,10 @@ CONSTRUCT { ?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon . ?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat . ?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon . +%record aoprop:spatialRegionPolygon ?spatialRegionPolygon . +?spatialRegionPolygon aoprop:geoPoint ?geoPoint . +?geoPoint aoprop:lat ?lat . +?geoPoint aoprop:lon ?lon . %record aoprop:spatialRegionWKTPolygon ?spatialRegionWKTPolygon . ?spatialRegionWKTPolygon aoprop:wkt ?wkt . %record aoprop:temporal ?temporal . @@ -103,15 +108,7 @@ where { %record aocat:has_type / skos:prefLabel ?resourceType . %record aocat:has_type ?typeURI . ?typeURI skos:prefLabel ?typeLabel . - optional { - %record aocat:is_about ?aboutURI . - ?aboutURI rdfs:label ?aboutLabel . - } optional { - %record aocat:has_native_subject ?nativeSubject . - ?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel . - } - optional { ?creator aocat:has_email ?creatorEmail . } optional { @@ -125,46 +122,54 @@ where { } } - graph { - optional { - %record aocat:has_derived_subject ?derivedSubject . - graph { - ?derivedSubject skos:prefLabel ?derivedSubjectPrefLabel . - } + optional { + graph { + select ?aboutURI ?aboutLabel + where { + + %record aocat:is_about ?aboutURI . + ?aboutURI rdfs:label ?aboutLabel . + } + limit 10 } } - { - select * - where { - optional { - graph { + optional { + graph { + select distinct ?temporalNative ?nativeLabel ?temporalNativePeriodName ?temporalNativeFrom ?temporalNativeUntil + where { %record aocat:has_temporal_coverage ?temporalNative . - ?temporalNative aocat:has_native_period / skos:prefLabel ?temporalNativePeriodName . + ?temporalNative aocat:has_native_period ?nativeLabel . + ?nativeLabel skos:prefLabel ?origTemporalNativePeriodName . optional { ?temporalNative aocat:from ?temporalNativeFrom . ?temporalNative aocat:until ?temporalNativeUntil . } + BIND(lcase(?origTemporalNativePeriodName) as ?temporalNativePeriodName) } } } - } optional { - graph { - %record aocat:has_temporal_coverage ?temporal . + graph { + select distinct ?temporal ?temporalPeriodName ?temporalFrom ?temporalUntil + where { + %record aocat:has_temporal_coverage ?temporal . + graph { + ?temporal aocat:has_period ?label . + graph { + + ?label skos:prefLabel ?origTemporalPeriodName . + } + optional { + ?temporal aocat:from ?temporalFrom . + ?temporal aocat:until ?temporalUntil . + } } - graph { - ?temporal aocat:has_period ?label . - graph { - ?label skos:prefLabel ?temporalPeriodName . - } - optional { - ?temporal aocat:from ?temporalFrom . - ?temporal aocat:until ?temporalUntil . - } - } + BIND(lcase(?origTemporalPeriodName) as ?temporalPeriodName) + } } + } graph { { @@ -246,6 +251,12 @@ where { aocat:has_bounding_box_min_lat ?spatialLocationBBMinLat ; aocat:has_bounding_box_min_lon ?spatialLocationBBMinLon ; } + optional { + %record aocat:has_spatial_coverage ?spatialRegionPolygon . + ?spatialRegionPolygon aocat:has_polygonal_representation ?geoPoint . + ?geoPoint aocat:has_latitude ?lat . + ?geoPoint aocat:has_longitude ?lon . + } optional { %record aocat:has_spatial_coverage ?spatialRegionWKTPolygon . ?spatialRegionWKTPolygon rdf:type aocat:AO_Spatial_Region_Polygon . @@ -254,5 +265,34 @@ where { } } } + + graph { + { + select distinct ?nativeSubject ?nativeSubjectPrefLabel + where { + optional { + %record aocat:has_native_subject ?nativeSubject . + ?nativeSubject skos:prefLabel ?origNativeSubjectPrefLabel . + } + BIND(lcase(?origNativeSubjectPrefLabel) as ?nativeSubjectPrefLabel) + } + } + } + + graph { + { + select distinct ?derivedSubject ?derivedSubjectPrefLabel + where { + optional { + %record aocat:has_derived_subject ?derivedSubject . + graph { + ?derivedSubject skos:prefLabel ?origDerivedSubjectPrefLabel . + } + } + BIND(lcase(?origDerivedSubjectPrefLabel) as ?derivedSubjectPrefLabel) + } + } + } + BIND (lang(?derivedSubjectPrefLabel) as ?aatSubjectsLang) } \ No newline at end of file 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 8707021..9015ebf 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 @@ -5,8 +5,8 @@ PREFIX aoprop: PREFIX onto: PREFIX ariadneplus: PREFIX time: - PREFIX rdf: + CONSTRUCT { %record aoprop:rdfType "Record" . %record aoprop:identifier %record . @@ -102,13 +102,7 @@ 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 . ?creator aocat:has_name ?creatorName . @@ -116,14 +110,9 @@ where { %record aocat:has_type / skos:prefLabel ?resourceType . %record aocat:has_type ?typeURI . ?typeURI skos:prefLabel ?typeLabel . - - - optional { ?creator aocat:has_email ?creatorEmail . } - - optional { %record aocat:has_description ?description . } @@ -139,12 +128,8 @@ where { optional { %record aocat:has_visual_component ?visualComponent . } - - } - - optional { graph { select ?aboutURI ?aboutLabel @@ -157,8 +142,6 @@ where { } } - - optional { graph { select distinct ?temporalNative ?nativeLabel ?temporalNativePeriodName ?temporalNativeFrom ?temporalNativeUntil @@ -175,8 +158,6 @@ where { } } - - optional { graph { select distinct ?temporal ?temporalPeriodName ?temporalFrom ?temporalUntil @@ -195,7 +176,7 @@ where { } BIND(lcase(?origTemporalPeriodName) as ?temporalPeriodName) } - } + } } graph { @@ -258,7 +239,6 @@ where { } } - graph { { select * @@ -292,7 +272,6 @@ where { } } - graph { { select distinct ?nativeSubject ?nativeSubjectPrefLabel 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 24303a4..084f5d0 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 @@ -332,7 +332,7 @@ public class GraphDbReaderAndESIndexTest { } @Test -// @Ignore + @Ignore public void uploadADSGreyLiteratureOver300TriplesTest() throws Exception { boolean isRecord = true; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/35AEC455-6CB5-31BB-B73E-30959FF3C4FE"; @@ -341,6 +341,16 @@ public class GraphDbReaderAndESIndexTest { readAndIndexTest(isRecord, recordId, datasource, collectionId); } + @Test +// @Ignore + public void uploadDimeBoundingBoxTest() throws Exception { + boolean isRecord = true; + String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/F9398BD5-DECB-3FF5-8077-D96893D0D0C6"; + String datasource = ":aarhusdime"; + String collectionId = "test"; + 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();