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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,17 +7,18 @@ import java.util.Map;
public class Spatial {
private String address;
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 coordinateSystem = new String("");
private String country = new String("");
private AriadneGeoPoint location;
private String placeName;
private String lat;
private String lon;
private String postcode = new String("");
public String getAddress() {
return address;

View File

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

View File

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