diff --git a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/ArchaeologicalResourceType.java b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/ArchaeologicalResourceType.java index ae7cce6..d891520 100644 --- a/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/ArchaeologicalResourceType.java +++ b/dnet-ariadneplus-graphdb-publisher/src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/ArchaeologicalResourceType.java @@ -3,32 +3,26 @@ package eu.dnetlib.ariadneplus.elasticsearch.model; import com.google.gson.Gson; import com.google.gson.JsonElement; +import java.util.HashMap; import java.util.Map; public class ArchaeologicalResourceType { - private long id = 100000; + private long id = -1; private String name; - public ArchaeologicalResourceType() { - } + private transient HashMap type =new HashMap<>(); -// public static ArchaeologicalResourceType fromRDFJson(JsonElement json) { -// ArchaeologicalResourceType art = new ArchaeologicalResourceType(); -// for (Map.Entry entry : json.getAsJsonObject().entrySet()){ -// switch (entry.getKey()){ -// case "https://www.ariadne-infrastructure.eu/property/id" : -// art.setId(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); -// break; -// case "https://www.ariadne-infrastructure.eu/property/name": -// String tmp = entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString(); -// art.setName(tmp); -// break; -// -// } -// } -// -// return art; -// } + public ArchaeologicalResourceType() { + type.put("Scientific analysis", new Long(10)); + type.put("Fieldwork", new Long(11)); + type.put("Fieldwork report", new Long(12)); + type.put("Scientific analysis", new Long(13)); + type.put("Date", new Long(14)); + type.put("Artefact", new Long(15)); + type.put("Fieldwork archive", new Long(16)); + type.put("Inscription", new Long(17)); + type.put("Burial", new Long(18)); + } public long getId() { return id; @@ -44,6 +38,15 @@ public class ArchaeologicalResourceType { public void setName(String name) { this.name = name; + if (this.name==null) { + setId(-1); + } + if (type.containsKey(this.name)) { + setId(type.get(name).longValue()); + } + else { + setId(-2); + } } public static ArchaeologicalResourceType fromJson(String json){