report returned to wf node

This commit is contained in:
Enrico Ottonello 2020-07-24 13:15:27 +02:00
parent 214502cc11
commit 220c6be6db
1 changed files with 5 additions and 3 deletions

View File

@ -334,6 +334,8 @@ public class GraphDBClient {
} }
public String indexOnES(String datasource, String collectionId) throws AriadnePlusPublisherException { public String indexOnES(String datasource, String collectionId) throws AriadnePlusPublisherException {
String recordsIndexReport = "";
String collectionIndexReport = "";
try { try {
log.info("Start indexing from "+ datasource + " " + collectionId); log.info("Start indexing from "+ datasource + " " + collectionId);
runSPQRLQuery.setupConnection( getWriterUser(), getWriterPwd(), this.graphDBServerUrl, getRepository()); runSPQRLQuery.setupConnection( getWriterUser(), getWriterPwd(), this.graphDBServerUrl, getRepository());
@ -344,16 +346,16 @@ public class GraphDBClient {
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_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());
boolean isCollection = false; boolean isCollection = false;
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, isCollection); recordsIndexReport = runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, isCollection);
List<String> collectionResourceId = runSPQRLQuery.selectCollectionId(datasource, collectionId); List<String> collectionResourceId = runSPQRLQuery.selectCollectionId(datasource, collectionId);
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql"); final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name()); String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
isCollection = true; isCollection = true;
runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceId, datasource, collectionId, isCollection); collectionIndexReport = runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceId, datasource, collectionId, isCollection);
}catch(Throwable e){ }catch(Throwable e){
log.error(e); log.error(e);
throw new AriadnePlusPublisherException(e); throw new AriadnePlusPublisherException(e);
} }
return "ok"; return "Records: ".concat(recordsIndexReport).concat(" Collection: ").concat(collectionIndexReport);
} }
} }