added rdfs:label to native period for collection query; fix iavp enrichment; added date formatter for es publishing

This commit is contained in:
Enrico Ottonello 2022-02-01 14:19:13 +01:00
parent 4abe06904b
commit 4b94935f17
4 changed files with 60 additions and 2 deletions

View File

@ -14,6 +14,7 @@ import java.util.Locale;
public class ESUtils {
private static DateTimeFormatter originalRecordDateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy");
private static DateTimeFormatter elasticSearchDateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static DateTimeFormatter fastCatDateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
private static ZoneId preferredZone = ZoneId.of("Europe/London");
private static DateTimeFormatter BST_FORMATTER = new DateTimeFormatterBuilder()
.appendPattern("EEE MMM dd HH:mm:ss ")
@ -43,7 +44,12 @@ public class ESUtils {
try {
return parseBST(originalDate);
} catch (Exception e3) {
return "0000";
try {
LocalDate parsedDate = LocalDate.parse(originalDate, fastCatDateFormatter);
return parsedDate.format(elasticSearchDateFormatter);
} catch (Exception e4) {
return "0000";
}
}
}
}

View File

@ -40,6 +40,27 @@ WHERE {
?lang skos:prefLabel ?langL
};
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::iavp::0> {
?s aocat:has_creator <https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> .
<https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Agent> .
<https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> rdfs:label "Not provided" .
<https://ariadne-infrastructure.eu/aocat/Agent/NOTPROVIDED> aocat:has_name "Not provided" .
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::iavp::0> {
?s rdf:type aocat:AO_Individual_Data_Resource .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_creator ?creator .
}
}
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
@ -105,4 +126,25 @@ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
?temporal aocat:from ?from .
?temporal aocat:until ?until .
}
};
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#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::iavp::0> {
?s aocat:has_type <https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/provided%20record> .
<https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/provided%20record> rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Concept> .
<https://ariadne-infrastructure.eu/aocat/Concept/AO_Type/provided%20record> skos:prefLabel "provided record"
}
}
WHERE {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::iavp::0> {
?s rdf:type aocat:AO_Individual_Data_Resource .
MINUS {
?s rdf:type aocat:AO_Individual_Data_Resource .
?s aocat:has_type ?t .
}
}
};

View File

@ -148,7 +148,7 @@ where {
where {
%record aocat:has_temporal_coverage ?temporalNative .
?temporalNative aocat:has_native_period ?nativeLabel .
?nativeLabel skos:prefLabel ?origTemporalNativePeriodName .
?nativeLabel skos:prefLabel|rdfs:label ?origTemporalNativePeriodName .
optional {
?temporalNative aocat:from ?temporalNativeFrom .
?temporalNative aocat:until ?temporalNativeUntil .

View File

@ -391,6 +391,16 @@ public class GraphDbReaderAndESIndexTest {
readAndIndexTest(isRecord, recordId, datasource, collectionId);
}
@Test
// @Ignore
public void uploadIAVPFastCatCollectionWasCreatedTest() throws Exception {
boolean isRecord = false;
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/IAVP/E60F992F-C34D-39B5-99AD-406BA27B090B";
String datasource = "iavp";
String collectionId = "collection";
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();