[Person] -

This commit is contained in:
Miriam Baglioni 2024-07-03 14:10:30 +02:00
parent a620d3ff21
commit bcbcba399d
6 changed files with 46 additions and 8 deletions

View File

@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import eu.dnetlib.dhp.schema.oaf.Oaf;
@JsonDeserialize(using = AtomicActionDeserializer.class)
public class AtomicAction<T extends Oaf> implements Serializable {
public class AtomicAction<T extends Object> implements Serializable {
private Class<T> clazz;

View File

@ -5,7 +5,7 @@ import eu.dnetlib.dhp.schema.oaf.OafEntity;
/** Actual entity types in the Graph */
public enum EntityType {
publication, dataset, otherresearchproduct, software, datasource, organization, project;
publication, dataset, otherresearchproduct, software, datasource, organization, project, person;
/**
* Resolves the EntityType, given the relative class name
@ -14,7 +14,7 @@ public enum EntityType {
* @param <T> actual OafEntity subclass
* @return the EntityType associated to the given class
*/
public static <T extends OafEntity> EntityType fromClass(Class<T> clazz) {
public static <T extends Object> EntityType fromClass(Class<T> clazz) {
return EntityType.valueOf(clazz.getSimpleName().toLowerCase());
}

View File

@ -3,5 +3,5 @@ package eu.dnetlib.dhp.schema.common;
/** Main entity types in the Graph */
public enum MainEntityType {
result, datasource, organization, project
result, datasource, organization, project, person
}

View File

@ -36,6 +36,7 @@ public class ModelSupport {
entityMapping.put(EntityType.datasource, MainEntityType.datasource);
entityMapping.put(EntityType.organization, MainEntityType.organization);
entityMapping.put(EntityType.project, MainEntityType.project);
entityMapping.put(EntityType.person, MainEntityType.person);
}
/**
@ -51,6 +52,7 @@ public class ModelSupport {
entityTypes.put(EntityType.otherresearchproduct, OtherResearchProduct.class);
entityTypes.put(EntityType.software, Software.class);
entityTypes.put(EntityType.publication, Publication.class);
entityTypes.put(EntityType.person, Person.class);
}
public static final Map<String, Class> oafTypes = Maps.newHashMap();
@ -64,6 +66,7 @@ public class ModelSupport {
oafTypes.put("software", Software.class);
oafTypes.put("publication", Publication.class);
oafTypes.put("relation", Relation.class);
oafTypes.put("person", Person.class);
}
public static final Map<Class, String> idPrefixMap = Maps.newHashMap();
@ -76,6 +79,7 @@ public class ModelSupport {
idPrefixMap.put(OtherResearchProduct.class, "50");
idPrefixMap.put(Software.class, "50");
idPrefixMap.put(Publication.class, "50");
idPrefixMap.put(Person.class, "30");
}
public static final Map<String, String> entityIdPrefix = Maps.newHashMap();
@ -85,6 +89,7 @@ public class ModelSupport {
entityIdPrefix.put("organization", "20");
entityIdPrefix.put("project", "40");
entityIdPrefix.put("result", "50");
entityIdPrefix.put("person", "30");
}
public static final Map<String, String> idPrefixEntity = Maps.newHashMap();
@ -92,6 +97,7 @@ public class ModelSupport {
static {
idPrefixEntity.put("10", "datasource");
idPrefixEntity.put("20", "organization");
idPrefixEntity.put("30", "person");
idPrefixEntity.put("40", "project");
idPrefixEntity.put("50", "result");
}
@ -206,7 +212,7 @@ public class ModelSupport {
private ModelSupport() {
}
public static <E extends OafEntity> String getIdPrefix(Class<E> clazz) {
public static <E extends Object> String getIdPrefix(Class<E> clazz) {
return idPrefixMap.get(clazz);
}

View File

@ -23,7 +23,7 @@ public class Person implements Serializable {
private List<KeyValue> collectedfrom;
private List<StructuredProperty> pid;
private List<Pid> pid;
private String dateofcollection;
@ -106,11 +106,12 @@ public class Person implements Serializable {
this.collectedfrom = collectedfrom;
}
public List<StructuredProperty> getPid() {
public List<Pid> getPid() {
return pid;
}
public void setPid(List<StructuredProperty> pid) {
public void setPid(List<Pid> pid) {
this.pid = pid;
}

View File

@ -0,0 +1,31 @@
package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
public class Pid implements Serializable {
private String schema;
private String value;
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static Pid newInstance(String schema, String value){
Pid pid = new Pid();
pid.schema = schema;
pid.value = value;
return pid;
}
}