diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java index 49cea00..f330b96 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/BulkUpload.java @@ -84,31 +84,29 @@ public class BulkUpload { ace.getContributor().clear(); ace.setContributor(ace.getCreator()); } - Distribution distribution = new Distribution(); - AgentInfo distrPublisher = new AgentInfo(); - distrPublisher.setEmail(""); - distrPublisher.setName(""); - distrPublisher.setType(""); - distribution.setPublisher(Arrays.asList(distrPublisher)); - ace.setDistribution(Arrays.asList(distribution)); - ItemMetadataStructure ims = new ItemMetadataStructure(); - ace.setHasItemMetadataStructure(Arrays.asList(ims)); - MetadataRecord mr = new MetadataRecord(); - Dex dex = new Dex(); - mr.setConformsTo(Arrays.asList(dex)); - ace.setHasMetadataRecord(Arrays.asList(mr)); - if (!isCollection) { - ace.setKeyword(Arrays.asList(new String(""))); - } - AgentInfo sr = new AgentInfo(); - ace.setScientificResponsible(Arrays.asList(sr)); - AgentInfo tr = new AgentInfo(); - ace.setTechnicalResponsible(Arrays.asList(tr)); +// Distribution distribution = new Distribution(); +// AgentInfo distrPublisher = new AgentInfo(); +// distrPublisher.setEmail(""); +// distrPublisher.setName(""); +// distrPublisher.setType(""); +// distribution.setPublisher(Arrays.asList(distrPublisher)); +// ace.setDistribution(Arrays.asList(distribution)); +// ItemMetadataStructure ims = new ItemMetadataStructure(); +// ace.setHasItemMetadataStructure(Arrays.asList(ims)); +// MetadataRecord mr = new MetadataRecord(); +// Dex dex = new Dex(); +// mr.setConformsTo(Arrays.asList(dex)); +// ace.setHasMetadataRecord(Arrays.asList(mr)); +// if (!isCollection) { +// ace.setKeyword(Arrays.asList(new String(""))); +// } +// AgentInfo sr = new AgentInfo(); +// ace.setScientificResponsible(Arrays.asList(sr)); +// AgentInfo tr = new AgentInfo(); +// ace.setTechnicalResponsible(Arrays.asList(tr)); } AgentInfo testPublisher = new AgentInfo(); testPublisher.setName("TEST"); - testPublisher.setPhone(null); - testPublisher.setEmail(null); ace.getPublisher().add(testPublisher); String[] splits = ace.getIdentifier().split("/"); @@ -122,13 +120,7 @@ public class BulkUpload { ace.getAatSubjects().forEach(s -> s.setId(aatSubjectId)); } - String idES; - if (isCollection) { - idES = "10000".concat(ace.getOriginalId()); - } - else { - idES = splits[splits.length-1]; - } + String idES = splits[splits.length-1]; request.add(new IndexRequest(elasticSearchIndexName).id(idES) .source(ace.toJson(),XContentType.JSON)); diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneCatalogEntry.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneCatalogEntry.java index 665e8fc..b0b9337 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneCatalogEntry.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneCatalogEntry.java @@ -39,16 +39,16 @@ public class AriadneCatalogEntry { private List technicalResponsible; private List temporal; - private String accrualPeriodicity = new String(""); + private String accrualPeriodicity;// = new String(""); private String audience;// IF PRESENT, MUST CONTAIN A VALUE !! - private String contactPoint = new String(""); + private String contactPoint;// = new String(""); private String extent;// IF PRESENT, MUST CONTAIN A VALUE !! - private String providerId = new String(""); - private String packageId = new String(""); - private String placeName = new String(""); - private String postcode = new String(""); - private String rdfAbout = new String(""); - private String rights = new String(""); + private String providerId;// = new String(""); + private String packageId;// = new String(""); + private String placeName;// = new String(""); + private String postcode;// = new String(""); + private String rdfAbout;// = new String(""); + private String rights;// = new String(""); public List getContributor() { return contributor; diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/Spatial.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/Spatial.java index 60a6979..e635161 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/Spatial.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/Spatial.java @@ -7,13 +7,13 @@ import java.util.Map; public class Spatial { - private String address = new String(""); + private String address;// = new String(""); private String boundingBoxMaxLat; private String boundingBoxMaxLon; private String boundingBoxMinLat; private String boundingBoxMinLon; private String coordinateSystem = new String(""); - private String country = new String(""); + private String country;// = new String(""); private AriadneGeoPoint location; private String placeName; private String lat; diff --git a/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java b/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java index 8ab23e1..9414f0f 100644 --- a/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java +++ b/dnet-ariadneplus-graphdb-publisher/test/java/eu/dnetlib/ariadneplus/GraphDbReaderAndESIndexTest.java @@ -53,16 +53,28 @@ public class GraphDbReaderAndESIndexTest { BulkUpload bulkUpload = new BulkUpload(); bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname")); runSPQRLQuery.setBulkUpload(bulkUpload); -// 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 recordId; + final ClassPathResource queryTemplateResource; + boolean testRecord = false; + if (testRecord) { + recordId = "https://ariadne-infrastructure.eu/aocat/Resource/0320AA03-BED9-3F2B-AF5D-E31EE50CAE97"; + queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql"); + } + else { + recordId = "https://ariadne-infrastructure.eu/aocat/Collection/ADS/849B1C0F-4C5F-3D8C-9082-CA60DBB4F557"; + queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql"); + } + String datasource = "ads"; String collectionId = "271"; List 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_record_data_template.sparql"); String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name()); - runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false); -// runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, true); + if (testRecord) { + runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false); + } + else { + runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, true); + } } @Test