fix geopoint on collection
This commit is contained in:
parent
66a5677e88
commit
5d9ce6a5fd
|
@ -70,6 +70,17 @@ public class BulkUpload {
|
||||||
uri.setLabel(ace.getTypeLabel());
|
uri.setLabel(ace.getTypeLabel());
|
||||||
ace.setHas_type(uri);
|
ace.setHas_type(uri);
|
||||||
|
|
||||||
|
if (ace.getSpatial()!=null) {
|
||||||
|
ace.getSpatial()
|
||||||
|
.stream()
|
||||||
|
.filter(s -> Objects.nonNull(s.getLat()) && Objects.nonNull(s.getLon()))
|
||||||
|
.forEach(s -> {
|
||||||
|
double lat = Double.parseDouble(s.getLat());
|
||||||
|
double lon = Double.parseDouble(s.getLon());
|
||||||
|
org.elasticsearch.common.geo.GeoPoint geopoint = new org.elasticsearch.common.geo.GeoPoint(lat, lon);
|
||||||
|
s.setGeopoint(geopoint);
|
||||||
|
});
|
||||||
|
}
|
||||||
if (isCollection) {
|
if (isCollection) {
|
||||||
ace.setResourceType("collection");
|
ace.setResourceType("collection");
|
||||||
if (ace.getSpatial()!=null) {
|
if (ace.getSpatial()!=null) {
|
||||||
|
@ -80,9 +91,6 @@ public class BulkUpload {
|
||||||
s.setPolygon(s.getWkt());
|
s.setPolygon(s.getWkt());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if (ace.getSpatial()==null) {
|
|
||||||
// ace.setSpatial(Arrays.asList(new Spatial()));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ace.setResourceType("dataset");
|
ace.setResourceType("dataset");
|
||||||
|
@ -95,15 +103,6 @@ public class BulkUpload {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (ace.getSpatial()!=null) {
|
if (ace.getSpatial()!=null) {
|
||||||
ace.getSpatial()
|
|
||||||
.stream()
|
|
||||||
.filter(s -> Objects.nonNull(s.getLat()) && Objects.nonNull(s.getLon()))
|
|
||||||
.forEach(s -> {
|
|
||||||
double lat = Double.parseDouble(s.getLat());
|
|
||||||
double lon = Double.parseDouble(s.getLon());
|
|
||||||
org.elasticsearch.common.geo.GeoPoint geopoint = new org.elasticsearch.common.geo.GeoPoint(lat, lon);
|
|
||||||
s.setGeopoint(geopoint);
|
|
||||||
});
|
|
||||||
ace.getSpatial()
|
ace.getSpatial()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(s -> Objects.nonNull(s.getBoundingBoxMaxLat())
|
.filter(s -> Objects.nonNull(s.getBoundingBoxMaxLat())
|
||||||
|
@ -124,11 +123,6 @@ public class BulkUpload {
|
||||||
PolygonBuilder polygonBuilder = new PolygonBuilder(coordinatesBuilder);
|
PolygonBuilder polygonBuilder = new PolygonBuilder(coordinatesBuilder);
|
||||||
String wkt = polygonBuilder.toWKT();
|
String wkt = polygonBuilder.toWKT();
|
||||||
s.setBoundingbox(wkt);
|
s.setBoundingbox(wkt);
|
||||||
// Coordinate topLeft = new Coordinate(minlon, maxlat);
|
|
||||||
// Coordinate bottomRight = new Coordinate(maxlon, minlat);
|
|
||||||
// EnvelopeBuilder envelopeBuilder = new EnvelopeBuilder(topLeft, bottomRight);
|
|
||||||
// String wkt = envelopeBuilder.toWKT();
|
|
||||||
// s.setBoundingbox(wkt);
|
|
||||||
});
|
});
|
||||||
ace.getSpatial()
|
ace.getSpatial()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -140,10 +134,6 @@ public class BulkUpload {
|
||||||
Double.parseDouble(p.getLon()),
|
Double.parseDouble(p.getLon()),
|
||||||
Double.parseDouble(p.getLat()));
|
Double.parseDouble(p.getLat()));
|
||||||
});
|
});
|
||||||
// PolygonBuilder polygonBuilder = new PolygonBuilder(coordinatesBuilder);
|
|
||||||
// String wkt = polygonBuilder.toWKT();
|
|
||||||
// log.debug("POLYGON "+wkt);
|
|
||||||
// s.setPolygon(wkt);
|
|
||||||
});
|
});
|
||||||
ace.getSpatial()
|
ace.getSpatial()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -166,39 +156,12 @@ public class BulkUpload {
|
||||||
ace.setSpatial(Arrays.asList(uniqueSpatial));
|
ace.setSpatial(Arrays.asList(uniqueSpatial));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else {
|
|
||||||
// if (ace.getSpatial()!=null) {
|
|
||||||
// Set<String> items = new HashSet<>();
|
|
||||||
// List<Spatial> spatialsNoDup = ace.getSpatial().stream()
|
|
||||||
// .filter(s -> !items.add(s.getPlaceName()))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// ace.getSpatial().clear();
|
|
||||||
// ace.setSpatial(spatialsNoDup);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
List<Spatial> dedupSpatials = removeDuplicates(ace.getSpatial());
|
List<Spatial> dedupSpatials = removeDuplicates(ace.getSpatial());
|
||||||
ace.getSpatial().clear();
|
ace.getSpatial().clear();
|
||||||
ace.setSpatial(dedupSpatials);
|
ace.setSpatial(dedupSpatials);
|
||||||
|
|
||||||
// TODO update following check according to new model definition
|
|
||||||
// if (ace.getSpatial().size()>1) {
|
|
||||||
// ace.getSpatial().removeIf(s -> (s.getPlaceName()!=null&&s.getPlaceName().equals("Name not provided")&&Objects.isNull(s.getLocation())));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// else {
|
|
||||||
// ace.setSpatial(Arrays.asList(new Spatial()));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (ace.getTemporal()!=null) {
|
|
||||||
// ace.getTemporal().stream()
|
|
||||||
// .filter(t->t.getMatchingPeriodOName()!=null)
|
|
||||||
// .forEach(t->{
|
|
||||||
// t.setPeriodName(t.getMatchingPeriodOName());
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (!isCollection) {
|
if (!isCollection) {
|
||||||
String uniqueIsPartOf = ace.getUniqueIsPartOf();
|
String uniqueIsPartOf = ace.getUniqueIsPartOf();
|
||||||
if (uniqueIsPartOf != null) {
|
if (uniqueIsPartOf != null) {
|
||||||
|
|
|
@ -241,16 +241,6 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
// @Ignore
|
|
||||||
public void uploadDIMEDigitalImageTest() throws Exception {
|
|
||||||
boolean isRecord = true;
|
|
||||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/DIME/F9398BD5-DECB-3FF5-8077-D96893D0D0C6";
|
|
||||||
String datasource = "aarhusdime";
|
|
||||||
String collectionId = "test";
|
|
||||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// @Ignore
|
// @Ignore
|
||||||
public void uploadFastiTest() throws Exception {
|
public void uploadFastiTest() throws Exception {
|
||||||
|
@ -345,9 +335,9 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
// @Ignore
|
// @Ignore
|
||||||
public void uploadDimeBoundingBoxTest() throws Exception {
|
public void uploadDimeBoundingBoxTest() throws Exception {
|
||||||
boolean isRecord = true;
|
boolean isRecord = true;
|
||||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/DIME/F9398BD5-DECB-3FF5-8077-D96893D0D0C6";
|
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/DIME/0E5FB5C7-6FCA-36AD-BEE5-03C9AFF393CD";
|
||||||
String datasource = "aarhusdime";
|
String datasource = "aarhusdime";
|
||||||
String collectionId = "test";
|
String collectionId = "oai";
|
||||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue