added mapping for polygon data when aocat:has_polygonal_representation is in wkt format (snd::zip)

This commit is contained in:
Enrico Ottonello 2021-06-22 11:06:56 +02:00
parent 41896d312b
commit 89f309feaa
6 changed files with 73 additions and 10 deletions

View File

@ -66,6 +66,14 @@ public class BulkUpload {
AriadnePlusEntry ace = ((AriadnePlusEntry) next); AriadnePlusEntry ace = ((AriadnePlusEntry) next);
if (isCollection) { if (isCollection) {
ace.setResourceType("collection"); ace.setResourceType("collection");
if (ace.getSpatial()!=null) {
ace.getSpatial()
.stream()
.filter(s -> Objects.nonNull(s.getWkt()))
.forEach(s -> {
s.setPolygon(s.getWkt());
});
}
// if (ace.getSpatial()==null) { // if (ace.getSpatial()==null) {
// ace.setSpatial(Arrays.asList(new Spatial())); // ace.setSpatial(Arrays.asList(new Spatial()));
// } // }
@ -123,6 +131,12 @@ public class BulkUpload {
log.debug("POLYGON "+wkt); log.debug("POLYGON "+wkt);
s.setPolygon(wkt); s.setPolygon(wkt);
}); });
ace.getSpatial()
.stream()
.filter(s -> Objects.nonNull(s.getWkt()))
.forEach(s -> {
s.setPolygon(s.getWkt());
});
if (ace.getSpatial().size()==2) { if (ace.getSpatial().size()==2) {
Spatial uniqueSpatial = new Spatial(); Spatial uniqueSpatial = new Spatial();
boolean uniquePlaceNameFound = ace.getSpatial().stream().filter(s -> s.getPlaceName()!=null).count()==1; boolean uniquePlaceNameFound = ace.getSpatial().stream().filter(s -> s.getPlaceName()!=null).count()==1;

View File

@ -23,6 +23,7 @@ public class Spatial {
private transient String lat; private transient String lat;
private transient String lon; private transient String lon;
private transient List<AriadneGeoPoint> polygonGeoPoints; private transient List<AriadneGeoPoint> polygonGeoPoints;
private transient String wkt;
public String getAddress() { public String getAddress() {
return address; return address;
@ -136,6 +137,14 @@ public class Spatial {
this.polygonGeoPoints = polygonGeoPoints; this.polygonGeoPoints = polygonGeoPoints;
} }
public String getWkt() {
return wkt;
}
public void setWkt(String wkt) {
this.wkt = wkt;
}
public Spatial() { public Spatial() {
} }

View File

@ -125,6 +125,11 @@ class.map.specifications={\
"substring": "no",\ "substring": "no",\
"element_type": "java.lang.String",\ "element_type": "java.lang.String",\
"external_reference": "AriadneGeoPoint"\ "external_reference": "AriadneGeoPoint"\
},\
"https://www.ariadne-infrastructure.eu/property/wkt": {\
"class_field": "Wkt",\
"substring": "no",\
"element_type": "java.lang.String"\
}\ }\
}\ }\
},\ },\
@ -281,6 +286,11 @@ class.map.specifications={\
"substring": "no",\ "substring": "no",\
"external_reference": "Spatial"\ "external_reference": "Spatial"\
},\ },\
"https://www.ariadne-infrastructure.eu/property/spatialRegionWKTPolygon": {\
"class_field": "Spatial",\
"substring": "no",\
"external_reference": "Spatial"\
},\
"https://www.ariadne-infrastructure.eu/property/landingPage": {\ "https://www.ariadne-infrastructure.eu/property/landingPage": {\
"class_field": "LandingPage",\ "class_field": "LandingPage",\
"substring": "no",\ "substring": "no",\

View File

@ -33,7 +33,6 @@ CONSTRUCT {
%record aoprop:landingPage ?landingPage . %record aoprop:landingPage ?landingPage .
%record aoprop:spatialRegion ?spatialRegion . %record aoprop:spatialRegion ?spatialRegion .
?spatialRegion aoprop:placeName ?spatialPlaceName . ?spatialRegion aoprop:placeName ?spatialPlaceName .
?spatialRegion aoprop:spatialCoordinateSystem ?spatialCoordinateSystem .
%record aoprop:spatialRegionPoint ?spatialRegionPoint . %record aoprop:spatialRegionPoint ?spatialRegionPoint .
?spatialRegionPoint aoprop:lat ?spatialLocationLat . ?spatialRegionPoint aoprop:lat ?spatialLocationLat .
?spatialRegionPoint aoprop:lon ?spatialLocationLon . ?spatialRegionPoint aoprop:lon ?spatialLocationLon .
@ -42,6 +41,8 @@ CONSTRUCT {
?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon . ?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon .
?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat . ?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat .
?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon . ?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon .
%record aoprop:spatialRegionWKTPolygon ?spatialRegionWKTPolygon .
?spatialRegionWKTPolygon aoprop:wkt ?wkt .
%record aoprop:temporal ?temporal . %record aoprop:temporal ?temporal .
?temporal aoprop:periodOName ?temporalPeriodName . ?temporal aoprop:periodOName ?temporalPeriodName .
?temporal aoprop:from ?temporalFrom . ?temporal aoprop:from ?temporalFrom .
@ -179,10 +180,6 @@ where {
%record aocat:has_spatial_coverage ?spatialRegion . %record aocat:has_spatial_coverage ?spatialRegion .
?spatialRegion aocat:has_place_name ?spatialPlaceName . ?spatialRegion aocat:has_place_name ?spatialPlaceName .
} }
optional {
%record aocat:has_spatial_coverage ?spatialRegion .
?spatialRegion aocat:has_coordinate_system ?spatialCoordinateSystem .
}
optional { optional {
%record aocat:has_spatial_coverage ?spatialRegionPoint . %record aocat:has_spatial_coverage ?spatialRegionPoint .
?spatialRegionPoint aocat:has_latitude ?spatialLocationLat ; ?spatialRegionPoint aocat:has_latitude ?spatialLocationLat ;
@ -195,6 +192,13 @@ where {
aocat:has_bounding_box_min_lat ?spatialLocationBBMinLat ; aocat:has_bounding_box_min_lat ?spatialLocationBBMinLat ;
aocat:has_bounding_box_min_lon ?spatialLocationBBMinLon ; aocat:has_bounding_box_min_lon ?spatialLocationBBMinLon ;
} }
optional {
%record aocat:has_spatial_coverage ?spatialRegionWKTPolygon .
?spatialRegionWKTPolygon rdf:type aocat:AO_Spatial_Region_Polygon .
?spatialRegionWKTPolygon aocat:has_polygonal_representation ?wkt .
filter (datatype(?wkt) = rdf:XMLLiteral)
filter (!isIRI(?wkt))
}
} }
} }
} }

View File

@ -33,7 +33,6 @@ CONSTRUCT {
%record aoprop:landingPage ?landingPage . %record aoprop:landingPage ?landingPage .
%record aoprop:spatialRegion ?spatialRegion . %record aoprop:spatialRegion ?spatialRegion .
?spatialRegion aoprop:placeName ?spatialPlaceName . ?spatialRegion aoprop:placeName ?spatialPlaceName .
?spatialRegion aoprop:spatialCoordinateSystem ?spatialCoordinateSystem .
%record aoprop:spatialRegionPoint ?spatialRegionPoint . %record aoprop:spatialRegionPoint ?spatialRegionPoint .
?spatialRegionPoint aoprop:lat ?spatialLocationLat . ?spatialRegionPoint aoprop:lat ?spatialLocationLat .
?spatialRegionPoint aoprop:lon ?spatialLocationLon . ?spatialRegionPoint aoprop:lon ?spatialLocationLon .
@ -46,6 +45,8 @@ CONSTRUCT {
?spatialRegionPolygon aoprop:geoPoint ?geoPoint . ?spatialRegionPolygon aoprop:geoPoint ?geoPoint .
?geoPoint aoprop:lat ?lat . ?geoPoint aoprop:lat ?lat .
?geoPoint aoprop:lon ?lon . ?geoPoint aoprop:lon ?lon .
%record aoprop:spatialRegionWKTPolygon ?spatialRegionWKTPolygon .
?spatialRegionWKTPolygon aoprop:wkt ?wkt .
%record aoprop:temporal ?temporal . %record aoprop:temporal ?temporal .
?temporal aoprop:periodOName ?temporalPeriodName . ?temporal aoprop:periodOName ?temporalPeriodName .
?temporal aoprop:from ?temporalFrom . ?temporal aoprop:from ?temporalFrom .
@ -163,10 +164,6 @@ where {
where { where {
%record aocat:has_spatial_coverage ?spatialRegion . %record aocat:has_spatial_coverage ?spatialRegion .
?spatialRegion aocat:has_place_name ?spatialPlaceName . ?spatialRegion aocat:has_place_name ?spatialPlaceName .
optional {
%record aocat:has_spatial_coverage ?spatialRegion .
?spatialRegion aocat:has_coordinate_system ?spatialCoordinateSystem .
}
optional { optional {
%record aocat:has_spatial_coverage ?spatialRegionPoint . %record aocat:has_spatial_coverage ?spatialRegionPoint .
?spatialRegionPoint aocat:has_latitude ?spatialLocationLat ; ?spatialRegionPoint aocat:has_latitude ?spatialLocationLat ;
@ -185,6 +182,13 @@ where {
?geoPoint aocat:has_latitude ?lat . ?geoPoint aocat:has_latitude ?lat .
?geoPoint aocat:has_longitude ?lon . ?geoPoint aocat:has_longitude ?lon .
} }
optional {
%record aocat:has_spatial_coverage ?spatialRegionWKTPolygon .
?spatialRegionWKTPolygon rdf:type aocat:AO_Spatial_Region_Polygon .
?spatialRegionWKTPolygon aocat:has_polygonal_representation ?wkt .
filter (datatype(?wkt) = rdf:XMLLiteral)
filter (!isIRI(?wkt))
}
} }
} }
} }

View File

@ -72,6 +72,7 @@ public class GraphDbReaderAndESIndexTest {
} }
@Test @Test
// @Ignore
public void uploadADSRecordTest() throws Exception { public void uploadADSRecordTest() throws Exception {
boolean isRecord = true; boolean isRecord = true;
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/34E3811A-0BAD-3832-B3A0-3139E8A0285C"; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/34E3811A-0BAD-3832-B3A0-3139E8A0285C";
@ -161,6 +162,7 @@ public class GraphDbReaderAndESIndexTest {
} }
@Test @Test
// @Ignore
public void uploadDansTemporalPolygonTest() throws Exception { public void uploadDansTemporalPolygonTest() throws Exception {
boolean isRecord = true; boolean isRecord = true;
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/D4E12349-E214-3F3F-BEE4-D39D9138916B"; String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/D4E12349-E214-3F3F-BEE4-D39D9138916B";
@ -219,6 +221,26 @@ public class GraphDbReaderAndESIndexTest {
readAndIndexTest(isRecord, recordId, datasource, collectionId); readAndIndexTest(isRecord, recordId, datasource, collectionId);
} }
@Test
// @Ignore
public void uploadFastiMultipleAriadneSubjectTest() throws Exception {
boolean isRecord = true;
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/FASTIONLINE/FE740BC7-2D9E-3644-A88E-3E8E5A5EA95F";
String datasource = "fasti";
String collectionId = "fieldwork";
readAndIndexTest(isRecord, recordId, datasource, collectionId);
}
@Test
// @Ignore
public void uploadSNDArchivePolygonTest() throws Exception {
boolean isRecord = false;
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/A7A2588A-1FE7-3FDD-AD66-C84EACE1860E";
String datasource = "snd";
String collectionId = "zip";
readAndIndexTest(isRecord, recordId, datasource, collectionId);
}
private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception { private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception {
final ClassPathResource resource = new ClassPathResource("application.properties"); final ClassPathResource resource = new ClassPathResource("application.properties");
Properties appProps = new Properties(); Properties appProps = new Properties();