removed extent and audience fields, empty values cause error on portal

This commit is contained in:
Enrico Ottonello 2020-07-09 16:35:04 +02:00
parent 31b7c61f62
commit 6a804f176b
3 changed files with 17 additions and 5 deletions

View File

@ -103,6 +103,16 @@ public class BulkUpload {
testPublisher.setName("TEST"); testPublisher.setName("TEST");
ace.getPublisher().add(testPublisher); ace.getPublisher().add(testPublisher);
String[] splits = ace.getIdentifier().split("/"); String[] splits = ace.getIdentifier().split("/");
if (ace.getAatSubjects() != null && ace.getDerivedSubject() != null) {
String aatSource = ace.getAatSubjects().get(0).getId();
ace.getDerivedSubject().forEach(d -> {
d.setSource(aatSource);
});
String [] aatSourceSplit = aatSource.split("/");
String aatSubjectId = aatSourceSplit[aatSourceSplit.length-1];
ace.getAatSubjects().forEach(s -> s.setId(aatSubjectId));
}
request.add(new IndexRequest(elasticSearchIndexName).id(splits[splits.length-1]) request.add(new IndexRequest(elasticSearchIndexName).id(splits[splits.length-1])
.source(ace.toJson(),XContentType.JSON)); .source(ace.toJson(),XContentType.JSON));
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT); BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);

View File

@ -40,9 +40,9 @@ public class AriadneCatalogEntry {
private List<AriadneTemporal> temporal; private List<AriadneTemporal> temporal;
private String accrualPeriodicity = new String(""); private String accrualPeriodicity = new String("");
private String audience = new String(""); private String audience;// IF PRESENT, MUST CONTAIN A VALUE !!
private String contactPoint = new String(""); private String contactPoint = new String("");
private String extent = new String(""); private String extent;// IF PRESENT, MUST CONTAIN A VALUE !!
private String providerId = new String(""); private String providerId = new String("");
private String packageId = new String(""); private String packageId = new String("");
private String placeName = new String(""); private String placeName = new String("");

View File

@ -53,13 +53,15 @@ public class GraphDbReaderAndESIndexTest {
BulkUpload bulkUpload = new BulkUpload(); BulkUpload bulkUpload = new BulkUpload();
bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname")); bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname"));
runSPQRLQuery.setBulkUpload(bulkUpload); runSPQRLQuery.setBulkUpload(bulkUpload);
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/ADS/849B1C0F-4C5F-3D8C-9082-CA60DBB4F557"; // String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/ADS/849B1C0F-4C5F-3D8C-9082-CA60DBB4F557";
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/0320AA03-BED9-3F2B-AF5D-E31EE50CAE97";
String datasource = "ads"; String datasource = "ads";
String collectionId = "271"; String collectionId = "271";
List<String> recordIds = Arrays.asList(recordId); List<String> recordIds = Arrays.asList(recordId);
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql"); // final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name()); String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, true); runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false);
} }