it is legal to have no individual resources or no collections: let's index what we have
This commit is contained in:
parent
f55699a324
commit
4fb5bb2941
|
@ -348,15 +348,19 @@ public class GraphDBClient {
|
|||
runSPQRLQuery.setResourceManager(resourceManager);
|
||||
runSPQRLQuery.setBulkUpload(bulkUpload);
|
||||
List<String> recordIds = runSPQRLQuery.selectRecordIds(datasource, collectionId);
|
||||
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||
boolean isCollection = false;
|
||||
recordsIndexReport = runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, isCollection);
|
||||
List<String> collectionResourceId = runSPQRLQuery.selectCollectionId(datasource, collectionId);
|
||||
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
|
||||
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
|
||||
isCollection = true;
|
||||
collectionIndexReport = runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceId, datasource, collectionId, isCollection);
|
||||
log.info(String.format("Found %d individual resources to index for datasource %s - %s", recordIds.size(), datasource, collectionId));
|
||||
if(!recordIds.isEmpty()) {
|
||||
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||
recordsIndexReport = runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false);
|
||||
}
|
||||
List<String> collectionResourceIds = runSPQRLQuery.selectCollectionIds(datasource, collectionId);
|
||||
log.info(String.format("Found %d collections to index for datasource %s - %s", recordIds.size(), datasource, collectionId));
|
||||
if(!collectionResourceIds.isEmpty()) {
|
||||
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
|
||||
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
|
||||
collectionIndexReport = runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceIds, datasource, collectionId, true);
|
||||
}
|
||||
}catch(Throwable e){
|
||||
log.error(e);
|
||||
throw new AriadnePlusPublisherException(e);
|
||||
|
|
|
@ -215,8 +215,8 @@ public class RunSPARQLQueryService {
|
|||
return executeSelect(query);
|
||||
}
|
||||
|
||||
public List<String> selectCollectionId(String datasource, String collectionId){
|
||||
log.debug("Retrieving collection Id from GraphDB ...");
|
||||
public List<String> selectCollectionIds(String datasource, String collectionId){
|
||||
log.debug("Retrieving collection Ids from GraphDB ...");
|
||||
String queryTemplate = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
|
||||
"select * \n" +
|
||||
"from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId>\n" +
|
||||
|
|
Loading…
Reference in New Issue