Person entity #37

Merged
claudio.atzori merged 9 commits from person_entity into master 2024-07-17 11:50:38 +02:00
14 changed files with 449 additions and 10 deletions

View File

@ -4,7 +4,8 @@
| **Version** | **Changes** | **Readiness** |
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| 6.1.3 | [Graph model] </br> <ul><li>Updated Solr JSON payload model classes</li></ul> | beta |
| 7.0.0 | [Graph model] </br> <ul><li>Introduced Person entity and its relations: authorship, coauthorship, affiliation</li><li>Updated Solr JSON payload model classes</li></ul> | beta |
| 6.1.3 | [Graph model] </br> <ul><li>Updated Solr JSON payload model classes</li></ul> | production |
| 6.1.1 | [Graph model] </br> <ul><li>Introduced constants used in the DOIBoost dismission.</li></ul> | production |
| 6.1.0 | [Graph model] </br> <ul><li>Introduced model classes to provide a JSON representation of records embedding information from the related entities.</li></ul> | production |
| 5.17.3 | [Graph model] </br> <ul><li>added result level textual field to store the transformative agreement information.</li></ul> | production |

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> implements Serializable {
private Class<T> clazz;

View File

@ -11,7 +11,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.Oaf;
public class AtomicActionDeserializer<T extends Oaf> extends JsonDeserializer<AtomicAction<T>> {
public class AtomicActionDeserializer<T > extends JsonDeserializer<AtomicAction<T>> {
@Override
@SuppressWarnings("unchecked")

View File

@ -1,11 +1,9 @@
package eu.dnetlib.dhp.schema.common;
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 +12,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> 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

@ -190,6 +190,23 @@ public class ModelConstants {
public static final String UNKNOWN = "UNKNOWN";
public static final String NOT_AVAILABLE = "not available";
public static final String RESULT_PERSON_RELTYPE = "resultPerson"; // relType
public static final String RESULT_PERSON_SUBRELTYPE = "authorship"; // subreltype
public static final String RESULT_PERSON_HASAUTHORED = "hasAuthored"; // relclass
public static final String PERSON_PERSON_RELTYPE = "personPerson"; // relType
public static final String PERSON_PERSON_SUBRELTYPE = "coAuthorship"; // subreltype
public static final String PERSON_PERSON_HASCOAUTHORED = "hasCoAuthor"; // relclass
public static final String PROJECT_PERSON_RELTYPE = "projectPerson"; // relType
public static final String PROJECT_PERSON_SUBRELTYPE = "participation"; // subreltype
public static final String PROJECT_PERSON_PARTICIPATES = "participatesToProject"; // relclass
// author affiliations are intended to be characterised by a start and an end date
public static final String ORG_PERSON_RELTYPE = "organizationPerson"; // relType
public static final String ORG_PERSON_SUBRELTYPE = "affiliation"; // subreltype
public static final String ORG_PERSON_PARTICIPATES = "isAffiliatedWith"; // relclass
public static final Qualifier PUBLICATION_DEFAULT_RESULTTYPE = qualifier(
PUBLICATION_RESULTTYPE_CLASSID, PUBLICATION_RESULTTYPE_CLASSID,
DNET_RESULT_TYPOLOGIES, DNET_RESULT_TYPOLOGIES);

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> String getIdPrefix(Class<E> clazz) {
return idPrefixMap.get(clazz);
}

View File

@ -0,0 +1,149 @@
package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.util.List;
public class Person implements Serializable {
private static final long serialVersionUID = -2366333710489222265L;
private String id;
private List<String> originalId;
private String givenName;
private String familyName;
private List<String> alternativeNames;
private String biography;
private List<PersonTopic> subject;
private List<KeyValue> collectedfrom;
private List<Pid> pid;
private String dateofcollection;
/**
* The Measures.
*/
private List<Measure> indicator;
/**
* The Context.
*/
private List<Context> context;
private Boolean consent;
public Person() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<String> getOriginalId() {
return originalId;
}
public void setOriginalId(List<String> originalId) {
this.originalId = originalId;
}
public String getGivenName() {
return givenName;
}
public void setGivenName(String givenName) {
this.givenName = givenName;
}
public String getFamilyName() {
return familyName;
}
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
public List<String> getAlternativeNames() {
return alternativeNames;
}
public void setAlternativeNames(List<String> alternativeNames) {
this.alternativeNames = alternativeNames;
}
public String getBiography() {
return biography;
}
public void setBiography(String biography) {
this.biography = biography;
}
public List<PersonTopic> getSubject() {
return subject;
}
public void setSubject(List<PersonTopic> subject) {
this.subject = subject;
}
public List<KeyValue> getCollectedfrom() {
return collectedfrom;
}
public void setCollectedfrom(List<KeyValue> collectedfrom) {
this.collectedfrom = collectedfrom;
}
public List<Pid> getPid() {
return pid;
}
public void setPid(List<Pid> pid) {
this.pid = pid;
}
public String getDateofcollection() {
return dateofcollection;
}
public void setDateofcollection(String dateofcollection) {
this.dateofcollection = dateofcollection;
}
public List<Measure> getIndicator() {
return indicator;
}
public void setIndicator(List<Measure> indicator) {
this.indicator = indicator;
}
public List<Context> getContext() {
return context;
}
public void setContext(List<Context> context) {
this.context = context;
}
public Boolean getConsent() {
return consent;
}
public void setConsent(Boolean consent) {
this.consent = consent;
}
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
import java.time.Year;
public class PersonTopic implements Serializable {
private static final long serialVersionUID = 102011326860637199L;
private String value;
private String schema;
private Year fromYear;
private Year toYear;
public PersonTopic() {
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public Year getFromYear() {
return fromYear;
}
public void setFromYear(Year fromYear) {
this.fromYear = fromYear;
}
public Year getToYear() {
return toYear;
}
public void setToYear(Year toYear) {
this.toYear = toYear;
}
}

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;
}
}

View File

@ -0,0 +1,113 @@
package eu.dnetlib.dhp.schema.solr;
import java.io.Serializable;
import java.util.List;
public class Person implements Serializable {
private static final long serialVersionUID = 3923041787040187202L;
private String givenName;
private String familyName;
private List<String> alternativeNames;
private String biography;
private List<PersonTopic> subject;
/**
* The Measures.
*/
private List<Measure> indicator;
/**
* The Context.
*/
private List<Context> context;
private Boolean consent;
public static Person newInstance(String givenName, String familyName, List<String> alternativeNames, String biography, List<PersonTopic> subject, List<Measure> indicator, List<Context> context, Boolean consent) {
final Person p = new Person();
p.setGivenName(givenName);
p.setFamilyName(familyName);
p.setAlternativeNames(alternativeNames);
p.setBiography(biography);
p.setSubject(subject);
p.setIndicator(indicator);
p.setContext(context);
p.setConsent(consent);
return p;
}
public Person() {
}
public String getGivenName() {
return givenName;
}
public void setGivenName(String givenName) {
this.givenName = givenName;
}
public String getFamilyName() {
return familyName;
}
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
public List<String> getAlternativeNames() {
return alternativeNames;
}
public void setAlternativeNames(List<String> alternativeNames) {
this.alternativeNames = alternativeNames;
}
public String getBiography() {
return biography;
}
public void setBiography(String biography) {
this.biography = biography;
}
public List<PersonTopic> getSubject() {
return subject;
}
public void setSubject(List<PersonTopic> subject) {
this.subject = subject;
}
public List<Measure> getIndicator() {
return indicator;
}
public void setIndicator(List<Measure> indicator) {
this.indicator = indicator;
}
public List<Context> getContext() {
return context;
}
public void setContext(List<Context> context) {
this.context = context;
}
public Boolean getConsent() {
return consent;
}
public void setConsent(Boolean consent) {
this.consent = consent;
}
}

View File

@ -0,0 +1,61 @@
package eu.dnetlib.dhp.schema.solr;
import java.io.Serializable;
import java.time.Year;
public class PersonTopic implements Serializable {
private static final long serialVersionUID = 6866697695308782412L;
private String value;
private String schema;
private Year fromYear;
private Year toYear;
public static PersonTopic newInstance(String value, String schema, Year fromYear, Year toYear) {
final PersonTopic personTopic = new PersonTopic();
personTopic.setValue(value);
personTopic.setSchema(schema);
personTopic.setFromYear(fromYear);
personTopic.setToYear(toYear);
return personTopic;
}
public PersonTopic() {
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public Year getFromYear() {
return fromYear;
}
public void setFromYear(Year fromYear) {
this.fromYear = fromYear;
}
public Year getToYear() {
return toYear;
}
public void setToYear(Year toYear) {
this.toYear = toYear;
}
}

View File

@ -9,6 +9,7 @@ public enum RecordType implements Serializable {
software,
datasource,
organization,
project;
project,
person;
}

View File

@ -28,6 +28,8 @@ public class SolrRecord implements Serializable {
private Organization organization;
private Person person;
private List<RelatedRecord> links;
public SolrRecordHeader getHeader() {
@ -102,6 +104,14 @@ public class SolrRecord implements Serializable {
this.organization = organization;
}
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
public List<RelatedRecord> getLinks() {
return links;
}