package eu.dnetlib.ariadneplus.elasticsearch.model; import com.google.gson.Gson; import eu.dnetlib.ariadneplus.reader.utils.ESUtils; import java.util.List; public class AriadneCatalogEntry { private List aatSubjects; private String accessPolicy; private String accessRights; private ArcheologicalResourceType archeologicalResourceType; private String contactPoint; private List contributor; private List creator; private List derivedSubject; private String description; private List distribution; private List publisher; private String title; private String extent; private List hasItemMetadataStructure; private List hasMetadataRecord; private String identifier; private String isPartOf; private String issued; private List keyword; private String landingPage; private String language; private List legalResponsible; private String modified; private List nativeSubject; private String originalId; private List owner; private String packageId; private String placeName; private String postcode; private String providerId; private String rdfAbout; private String resourceType; private String rights; private List scientificResponsible; private List spatial; // private List spatialRegion; // private List spatialRegionPoint; private List technicalResponsible; private List temporal; public List getContributor() { return contributor; } public void setContributor(List contributor) { this.contributor = contributor; } public List getAatSubjects() { return aatSubjects; } public void setAatSubjects(List aatSubjects) { this.aatSubjects = aatSubjects; } public String getAccessPolicy() { return accessPolicy; } public void setAccessPolicy(String accessPolicy) { this.accessPolicy = accessPolicy; } public String getAccessRights() { return accessRights; } public void setAccessRights(String accessRights) { this.accessRights = accessRights; } public ArcheologicalResourceType getArcheologicalResourceType() { return archeologicalResourceType; } public void setArcheologicalResourceType(ArcheologicalResourceType archeologicalResourceType) { this.archeologicalResourceType = archeologicalResourceType; } public String getContactPoint() { return contactPoint; } public void setContactPoint(String contactPoint) { this.contactPoint = contactPoint; } public List getCreator() { return creator; } public void setCreator(List creator) { this.creator = creator; } public List getDerivedSubject() { return derivedSubject; } public void setDerivedSubject(List derivedSubject) { this.derivedSubject = derivedSubject; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public List getDistribution() { return distribution; } public void setDistribution(List distribution) { this.distribution = distribution; } public List getPublisher() { return publisher; } public void setPublisher(List publisher) { this.publisher = publisher; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getExtent() { return extent; } public void setExtent(String extent) { this.extent = extent; } public List getHasItemMetadataStructure() { return hasItemMetadataStructure; } public void setHasItemMetadataStructure(List hasItemMetadataStructure) { this.hasItemMetadataStructure = hasItemMetadataStructure; } public List getHasMetadataRecord() { return hasMetadataRecord; } public void setHasMetadataRecord(List hasMetadataRecord) { this.hasMetadataRecord = hasMetadataRecord; } public String getIdentifier() { return identifier; } public void setIdentifier(String identifier) { this.identifier = identifier; } public String getIsPartOf() { return isPartOf; } public void setIsPartOf(String isPartOf) { this.isPartOf = isPartOf; } public String getIssued() { return issued; } public void setIssued(String issued) { this.issued = ESUtils.getESFormatDate(issued); } public List getKeyword() { return keyword; } public void setKeyword(List keyword) { this.keyword = keyword; } public String getLandingPage() { return landingPage; } public void setLandingPage(String landingPage) { this.landingPage = landingPage; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public List getLegalResponsible() { return legalResponsible; } public void setLegalResponsible(List legalResponsible) { this.legalResponsible = legalResponsible; } public String getModified() { return modified; } public void setModified(String modified) { this.modified = ESUtils.getESFormatDate(modified); } public List getNativeSubject() { return nativeSubject; } public void setNativeSubject(List nativeSubject) { this.nativeSubject = nativeSubject; } public String getOriginalId() { return originalId; } public void setOriginalId(String originalId) { this.originalId = originalId; } public List getOwner() { return owner; } public void setOwner(List owner) { this.owner = owner; } public String getPackageId() { return packageId; } public void setPackageId(String packageId) { this.packageId = packageId; } public String getPlaceName() { return placeName; } public void setPlaceName(String placeName) { this.placeName = placeName; } public String getPostcode() { return postcode; } public void setPostcode(String postcode) { this.postcode = postcode; } public String getProviderId() { return providerId; } public void setProviderId(String providerId) { this.providerId = providerId; } public String getRdfAbout() { return rdfAbout; } public void setRdfAbout(String rdfAbout) { this.rdfAbout = rdfAbout; } public String getResourceType() { return resourceType; } public void setResourceType(String resourceType) { this.resourceType = resourceType; } public String getRights() { return rights; } public void setRights(String rights) { this.rights = rights; } public List getScientificResponsible() { return scientificResponsible; } public void setScientificResponsible(List scientificResponsible) { this.scientificResponsible = scientificResponsible; } public List getSpatial() { return spatial; } public void setSpatial(List spatial) { if (this.spatial==null) { this.spatial = spatial; } else { this.spatial.addAll(spatial); } } public List getTechnicalResponsible() { return technicalResponsible; } public void setTechnicalResponsible(List technicalResponsible) { this.technicalResponsible = technicalResponsible; } public List getTemporal() { return temporal; } public void setTemporal(List temporal) { this.temporal = temporal; } public static AriadneCatalogEntry fromJson(String json){ return new Gson().fromJson(json, AriadneCatalogEntry.class); } public String toJson(){ return new Gson().toJson(this); } // public static AriadneCatalogEntry fromRDFJson(JsonElement json, String identifier, Map map){ // AriadneCatalogEntry acim = new AriadneCatalogEntry(); // acim.setIdentifier(identifier.substring(identifier.lastIndexOf("/") + 1)); // JsonObject content = json.getAsJsonObject(); // for (Map.Entry stringJsonElementEntry : content.entrySet()) { // switch (stringJsonElementEntry.getKey()){ // case "https://www.ariadne-infrastructure.eu/property/accessPolicy": // acim.setAccessPolicy(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/accessRights": // acim.setAccessRights(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/contributor": // JsonArray contributor_array = stringJsonElementEntry.getValue().getAsJsonArray(); // List contributor_list = new ArrayList(); // for (int i = 0; i < contributor_array.size() ; i++ ){ // String map_key = contributor_array.get(i).getAsJsonObject().get("value").getAsString(); // contributor_list.add(AgentInfo.fromRDFJson(map.get(map_key))); // // } // acim.setContributor(contributor_list); // break; // case "https://www.ariadne-infrastructure.eu/property/description": // acim.setDescription(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/isPartOf": // acim.setPartOf(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/issued": // acim.setIssued(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/landingPage": // acim.setLandingPage(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/language": // acim.setLanguage(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/modified": // acim.setModified(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/nativeSubject": // JsonArray nativeSubject_array = stringJsonElementEntry.getValue().getAsJsonArray(); // List nativeSubject_list = new ArrayList(); // for (int i = 0; i < nativeSubject_array.size() ; i++ ){ // String map_key = nativeSubject_array.get(i).getAsJsonObject().get("value").getAsString(); // nativeSubject_list.add(NativeSubject.fromRDFJson(map.get(map_key))); // // } // acim.setNativeSubject(nativeSubject_list); // break; // case "https://www.ariadne-infrastructure.eu/property/originalId": // acim.setOriginalId(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/resourceType": // acim.setResourceType(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/spatial": // JsonArray spatial_array = stringJsonElementEntry.getValue().getAsJsonArray(); // List spatial_list = new ArrayList(); // for (int i = 0; i < spatial_array.size() ; i++ ){ // String map_key = spatial_array.get(i).getAsJsonObject().get("value").getAsString(); // spatial_list.add(Spatial.fromRDFJson(map.get(map_key), map)); // // } // acim.setSpatial(spatial_list); // break; // case "https://www.ariadne-infrastructure.eu/property/temporal": // JsonArray temporal_array = stringJsonElementEntry.getValue().getAsJsonArray(); // List temporal_list = new ArrayList<>(); // for(int i=0; i < temporal_array.size(); i++){ // String map_key = temporal_array.get(i).getAsJsonObject().get("value").getAsString(); // temporal_list.add(AriadneTemporal.fromRDFJson(map.get(map_key))); // } // acim.setTemporal(temporal_list); // break; // case "https://www.ariadne-infrastructure.eu/property/title": // acim.setTitle(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/publisher": // JsonArray publisher_array = stringJsonElementEntry.getValue().getAsJsonArray(); // List publisher_list = new ArrayList(); // for (int i = 0; i < publisher_array.size() ; i++ ){ // String map_key = publisher_array.get(i).getAsJsonObject().get("value").getAsString(); // publisher_list.add(AgentInfo.fromRDFJson(map.get(map_key))); // // } // acim.setPublisher(publisher_list); // break; // case "https://www.ariadne-infrastructure.eu/property/archeologicalResourceType": // acim.setArcheologicalResourceType(ArcheologicalResourceType.fromRDFJson(map.get(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()))); // } // // // } // // System.out.println(acim.toJson()); // return acim; // } }