all ES fields are now mapped

This commit is contained in:
Enrico Ottonello 2020-07-08 10:50:14 +02:00
parent 9737184b1e
commit e689623994
10 changed files with 53 additions and 26 deletions

View File

@ -1,8 +1,6 @@
package eu.dnetlib.ariadneplus.elasticsearch; package eu.dnetlib.ariadneplus.elasticsearch;
import eu.dnetlib.ariadneplus.elasticsearch.model.AgentInfo; import eu.dnetlib.ariadneplus.elasticsearch.model.*;
import eu.dnetlib.ariadneplus.elasticsearch.model.AriadneCatalogEntry;
import eu.dnetlib.ariadneplus.elasticsearch.model.Spatial;
import eu.dnetlib.ariadneplus.reader.ResourceManager; import eu.dnetlib.ariadneplus.reader.ResourceManager;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -77,6 +75,29 @@ public class BulkUpload {
if (uniqueIsPartOf!=null) { if (uniqueIsPartOf!=null) {
ace.setIsPartOf(Arrays.asList(uniqueIsPartOf)); ace.setIsPartOf(Arrays.asList(uniqueIsPartOf));
} }
if (ace.getContributor()!=null) {
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));
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(); AgentInfo testPublisher = new AgentInfo();
testPublisher.setName("TEST"); testPublisher.setName("TEST");
ace.getPublisher().add(testPublisher); ace.getPublisher().add(testPublisher);

View File

@ -6,9 +6,9 @@ import com.google.gson.JsonElement;
import java.util.Map; import java.util.Map;
public class AgentInfo { public class AgentInfo {
private String email; private String email = new String("");
private String name; private String name = new String("");
private String phone; private String phone = new String("");
private String type = new String(""); private String type = new String("");
public AgentInfo() { public AgentInfo() {

View File

@ -10,7 +10,6 @@ public class AriadneCatalogEntry {
private String accessPolicy; private String accessPolicy;
private String accessRights; private String accessRights;
private ArchaeologicalResourceType archaeologicalResourceType; private ArchaeologicalResourceType archaeologicalResourceType;
private String contactPoint;
private List<AgentInfo> contributor; private List<AgentInfo> contributor;
private List<AgentInfo> creator; private List<AgentInfo> creator;
private List<DerivedSubject> derivedSubject; private List<DerivedSubject> derivedSubject;
@ -18,7 +17,6 @@ public class AriadneCatalogEntry {
private List <Distribution> distribution; private List <Distribution> distribution;
private List<AgentInfo> publisher; private List<AgentInfo> publisher;
private String title; private String title;
private String extent;
private List<ItemMetadataStructure> hasItemMetadataStructure; private List<ItemMetadataStructure> hasItemMetadataStructure;
private List<MetadataRecord> hasMetadataRecord; private List<MetadataRecord> hasMetadataRecord;
private String identifier; private String identifier;
@ -33,13 +31,7 @@ public class AriadneCatalogEntry {
private List<NativeSubject> nativeSubject; private List<NativeSubject> nativeSubject;
private String originalId; private String originalId;
private List<AgentInfo> owner; private List<AgentInfo> owner;
private String packageId = new String("");;
private String placeName;
private String postcode;
private String providerId = new String("");;
private String rdfAbout;
private String resourceType; private String resourceType;
private String rights;
private List<AgentInfo> scientificResponsible; private List<AgentInfo> scientificResponsible;
private List<Spatial> spatial; private List<Spatial> spatial;
// private List<SpatialRegion> spatialRegion; // private List<SpatialRegion> spatialRegion;
@ -47,6 +39,17 @@ public class AriadneCatalogEntry {
private List<AgentInfo> technicalResponsible; private List<AgentInfo> technicalResponsible;
private List<AriadneTemporal> temporal; private List<AriadneTemporal> temporal;
private String accrualPeriodicity = new String("");
private String audience = new String("");
private String contactPoint = new String("");
private String extent = 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<AgentInfo> getContributor() { public List<AgentInfo> getContributor() {
return contributor; return contributor;
} }

View File

@ -3,8 +3,8 @@ package eu.dnetlib.ariadneplus.elasticsearch.model;
import com.google.gson.Gson; import com.google.gson.Gson;
public class Dex { public class Dex {
private String characterSet; private String characterSet = new String("");
private String description; private String description = new String("");
public String getCharacterSet() { public String getCharacterSet() {
return characterSet; return characterSet;

View File

@ -5,12 +5,12 @@ import com.google.gson.Gson;
import java.util.List; import java.util.List;
public class Distribution { public class Distribution {
private String accessURL; private String accessURL = new String("");
private String description; private String description = new String("");
private String issued; private String issued = new String("9999");
private String modified; private String modified = new String("9999");
private List<AgentInfo> publisher; private List<AgentInfo> publisher;
private String title; private String title = new String("");
public String getTitle() { public String getTitle() {
return title; return title;

View File

@ -3,7 +3,7 @@ package eu.dnetlib.ariadneplus.elasticsearch.model;
import com.google.gson.Gson; import com.google.gson.Gson;
public class ItemMetadataStructure { public class ItemMetadataStructure {
private String characterSet; private String characterSet = new String("");
public String getCharacterSet() { public String getCharacterSet() {
return characterSet; return characterSet;

View File

@ -6,7 +6,7 @@ import java.util.List;
public class MetadataRecord { public class MetadataRecord {
private List<Dex> conformsTo; private List<Dex> conformsTo;
private String xmlDoc; private String xmlDoc = new String("");
public List<Dex> getConformsTo() { public List<Dex> getConformsTo() {
return conformsTo; return conformsTo;

View File

@ -7,17 +7,18 @@ import java.util.Map;
public class Spatial { public class Spatial {
private String address; private String address = new String("");
private String boundingBoxMaxLat; private String boundingBoxMaxLat;
private String boundingBoxMaxLon; private String boundingBoxMaxLon;
private String boundingBoxMinLat; private String boundingBoxMinLat;
private String boundingBoxMinLon; private String boundingBoxMinLon;
private String coordinateSystem = new String("");; private String coordinateSystem = new String("");
private String country = new String("");; private String country = new String("");
private AriadneGeoPoint location; private AriadneGeoPoint location;
private String placeName; private String placeName;
private String lat; private String lat;
private String lon; private String lon;
private String postcode = new String("");
public String getAddress() { public String getAddress() {
return address; return address;

View File

@ -94,6 +94,7 @@ public class RunSPARQLQueryService {
if (isCollection) { if (isCollection) {
parser.setCollection(true); parser.setCollection(true);
} }
log.debug("rdf > json : "+recordWriter.toString());
parser.parse(recordWriter.toString()); parser.parse(recordWriter.toString());
resourceManager.manage(parser); resourceManager.manage(parser);
bulkUpload.index(resourceManager, isCollection); bulkUpload.index(resourceManager, isCollection);

View File

@ -45,6 +45,7 @@ CONSTRUCT {
?temporal aoprop:periodName ?temporalPeriodName . ?temporal aoprop:periodName ?temporalPeriodName .
?temporal aoprop:from ?temporalFrom . ?temporal aoprop:from ?temporalFrom .
?temporal aoprop:until ?temporalUntil . ?temporal aoprop:until ?temporalUntil .
?temporal aoprop:uri ?temporal .
%record aoprop:uri ?temporalNative . %record aoprop:uri ?temporalNative .
?temporalNative aoprop:periodName ?temporalNativePeriodName . ?temporalNative aoprop:periodName ?temporalNativePeriodName .
%record aoprop:archeologicalResourceType ?archeologicalResourceType . %record aoprop:archeologicalResourceType ?archeologicalResourceType .