Compare commits

...

3 Commits

3 changed files with 278 additions and 22 deletions

View File

@ -150,26 +150,28 @@ public class BulkUpload {
.forEach(s -> {
s.setPolygon(s.getWkt());
});
if (ace.getSpatial().size()==2) {
Spatial uniqueSpatial = new Spatial();
boolean uniquePlaceNameFound = ace.getSpatial().stream().filter(s -> s.getPlaceName()!=null).count()==1;
boolean uniqueLocationFound = ace.getSpatial().stream().filter(s -> s.getGeopoint()!=null).count()==1;
if (uniquePlaceNameFound&&uniqueLocationFound) {
ace.getSpatial().stream().filter(s -> s.getPlaceName()!=null).forEach(s -> {
uniqueSpatial.setPlaceName(s.getPlaceName());
});
ace.getSpatial().stream().filter(s -> s.getGeopoint()!=null).forEach(s -> {
uniqueSpatial.setGeopoint(s.getGeopoint());
});
ace.getSpatial().clear();
ace.setSpatial(Arrays.asList(uniqueSpatial));
}
}
List<Spatial> dedupSpatials = removeDuplicates(ace.getSpatial());
ace.getSpatial().clear();
ace.setSpatial(dedupSpatials);
}
}
if (ace.getSpatial()!=null) {
if (ace.getSpatial().size()==2) {
Spatial uniqueSpatial = new Spatial();
boolean uniquePlaceNameFound = ace.getSpatial().stream().filter(s -> s.getPlaceName()!=null).count()==1;
boolean uniqueLocationFound = ace.getSpatial().stream().filter(s -> s.getGeopoint()!=null).count()==1;
if (uniquePlaceNameFound&&uniqueLocationFound) {
ace.getSpatial().stream().filter(s -> s.getPlaceName()!=null).forEach(s -> {
uniqueSpatial.setPlaceName(s.getPlaceName());
});
ace.getSpatial().stream().filter(s -> s.getGeopoint()!=null).forEach(s -> {
uniqueSpatial.setGeopoint(s.getGeopoint());
});
ace.getSpatial().clear();
ace.setSpatial(Arrays.asList(uniqueSpatial));
}
}
List<Spatial> dedupSpatials = removeDuplicates(ace.getSpatial());
ace.getSpatial().clear();
ace.setSpatial(dedupSpatials);
}
String[] splits = ace.getIdentifier().split("/");

View File

@ -0,0 +1,238 @@
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?collection aocat:has_ARIADNE_subject ?archeologicalResourceType .
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
?archeologicalResourceType rdfs:label ?archeologicalResourceTypeName .
}
}
WHERE {
?collection rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
?collection aocat:has_ARIADNE_subject ?archeologicalResourceType .
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
?collection aocat:has_original_id "1000001" .
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s aocat:has_temporal_coverage <https://ariadne-infrastructure.eu/aocat/Time-Span/NOTPROVIDED> .
<https://ariadne-infrastructure.eu/aocat/Time-Span/NOTPROVIDED> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Temporal_Region> .
<https://ariadne-infrastructure.eu/aocat/Time-Span/NOTPROVIDED> rdfs:label "Not provided" .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
MINUS {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
?s aocat:has_temporal_coverage ?tc .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s aocat:has_temporal_coverage <https://ariadne-infrastructure.eu/aocat/Time-Span/NOTPROVIDED> .
<https://ariadne-infrastructure.eu/aocat/Time-Span/NOTPROVIDED> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Temporal_Region> .
<https://ariadne-infrastructure.eu/aocat/Time-Span/NOTPROVIDED> rdfs:label "Not provided" .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
MINUS {
?s rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .
?s aocat:has_temporal_coverage ?tc .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?record aocat:was_issued ?issued .
?record aocat:was_modified ?modified .
?record aocat:has_contributor ?contributor .
?record aocat:has_responsible ?legalResponsible .
?record aocat:has_owner ?owner .
?record aocat:has_publisher ?publisher .
?record aocat:has_access_rights ?accessRights .
?record aocat:has_ARIADNE_subject ?archeologicalResourceType .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime>
WHERE {
?record aocat:is_part_of ?collection .
?collection aocat:was_issued ?issued .
?collection aocat:was_modified ?modified .
?collection aocat:has_contributor ?contributor .
?collection aocat:has_responsible ?legalResponsible .
?collection aocat:has_owner ?owner .
?collection aocat:has_publisher ?publisher .
?collection aocat:has_access_rights ?accessRights .
?collection aocat:has_ARIADNE_subject ?archeologicalResourceType .
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s aocat:has_native_subject ?ns .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime>
WHERE {
?s aocat:is_about ?about .
?about aocat:has_type ?ns .
?ns rdf:type aocat:AO_Concept .
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s aocat:has_native_subject <https://ariadne-infrastructure.eu/aocat/Concept/hes/NOT_PROVIDED> .
<https://ariadne-infrastructure.eu/aocat/Concept/hes/NOT_PROVIDED> skos:prefLabel "Not provided" .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s rdf:type aocat:AO_Individual_Data_Resource .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_native_subject ?ns .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s aocat:has_temporal_coverage ?t .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime>
WHERE {
?s aocat:is_about ?about .
?about aocat:has_time_interval ?t .
?t rdf:type aocat:AO_Temporal_Region .
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::hes::aatplus> {
?record aocat:has_derived_subject ?aat .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::aat>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime>
WHERE {
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:exactMatch ?aat .
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:broadMatch ?aat .
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:closeMatch ?aat .
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:narrowMatch ?aat .
}
};
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX time: <http://www.w3.org/2006/time#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::hes::periodoplus> {
?temporal aocat:has_period ?periodO .
?temporal aocat:from ?temporalFrom .
?temporal aocat:until ?temporalUntil .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?temporal aocat:has_native_period ?native_period .
?native_period skos:prefLabel ?native_label .
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::hes::periodo> {
?periodO skos:altLabel ?lowercase_native_label .
?periodO skos:inScheme <http://n2t.net/ark:/99152/p0xxt6t> .
?periodO time:intervalStartedBy ?intervalStartedBy .
?intervalStartedBy skos:prefLabel ?temporalFrom .
?periodO time:intervalFinishedBy ?intervalFinishedBy .
?intervalFinishedBy skos:prefLabel ?temporalUntil .
BIND(ucase(?lowercase_native_label) as ?native_label)
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?c aocat:has_name ?l .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_owner ?c .
?c rdfs:label ?l .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_owner ?c .
?c aocat:has_name ?n .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?c aocat:has_name ?l .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::hes::maritime> {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_publisher ?c .
?c rdfs:label ?l .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_publisher ?c .
?c aocat:has_name ?n .
}
}
};

View File

@ -358,11 +358,9 @@ public class GraphDbReaderAndESIndexTest {
@Test
public void uploadDoliaTest() throws Exception {
boolean isRecord = true;
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/Inrap/F0E19AC1-AE02-3BE5-AF78-D9EEC1670AC1";
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/Inrap/EEAA72F8-3C33-3211-A56B-296164B5A317";
String datasource = "dolia";
String collectionId = "fieldworkreport";
readAndIndexTest(isRecord, recordId, datasource, collectionId);
recordId = "https://ariadne-infrastructure.eu/aocat/Resource/Inrap/28630596-6EFF-38D7-91C7-8A6134CBD91B";
String collectionId = "full";
readAndIndexTest(isRecord, recordId, datasource, collectionId);
}
@ -402,6 +400,24 @@ public class GraphDbReaderAndESIndexTest {
readAndIndexTest(isRecord, recordId, datasource, collectionId);
}
@Test
public void uploadMibacTest() throws Exception {
boolean isRecord = false;
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/MiC/662BD48F-7313-3017-8040-14CFFE1A02EB";
String datasource = "mibac";
String collectionId = "test";
readAndIndexTest(isRecord, recordId, datasource, collectionId);
}
@Test
public void uploadBMPASTest() throws Exception {
boolean isRecord = true;
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/BMPAS/A561885D-2480-3794-82AD-A06B7462DA74";
String datasource = "bmpas";
String collectionId = "coins";
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();