2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.schema.oaf;
|
|
|
|
|
2023-01-31 14:36:13 +01:00
|
|
|
import java.io.Serializable;
|
2021-08-10 09:36:37 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Relation models any edge between two nodes in the OpenAIRE graph. It has a source id and a target id pointing to
|
|
|
|
* graph node identifiers and it is further characterised by the semantic of the link through the fields relType,
|
|
|
|
* subRelType and relClass. Provenance information is modeled according to the dataInfo element and collectedFrom, while
|
|
|
|
* individual relationship types can provide extra information via the properties field.
|
|
|
|
*/
|
2023-01-31 14:36:13 +01:00
|
|
|
public class Relation extends Oaf implements Serializable {
|
2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Main relationship classifier, values include 'resultResult', 'resultProject', 'resultOrganization', etc.
|
|
|
|
*/
|
|
|
|
private String relType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Further classifies a relationship, values include 'affiliation', 'similarity', 'supplement', etc.
|
|
|
|
*/
|
|
|
|
private String subRelType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges,
|
|
|
|
* 'isMergedIn'.
|
|
|
|
*/
|
|
|
|
private String relClass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The source entity id.
|
|
|
|
*/
|
|
|
|
private String source;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The target entity id.
|
|
|
|
*/
|
|
|
|
private String target;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Was this relationship authoritatively validated?
|
|
|
|
*/
|
|
|
|
private Boolean validated;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When was this relationship authoritatively validated.
|
|
|
|
*/
|
|
|
|
private String validationDate;
|
|
|
|
|
2023-01-31 14:36:13 +01:00
|
|
|
private List<Provenance> provenance;
|
2023-02-02 17:01:22 +01:00
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
/**
|
|
|
|
* List of relation specific properties. Values include 'similarityLevel', indicating the similarity score between a
|
|
|
|
* pair of publications.
|
|
|
|
*/
|
|
|
|
private List<KeyValue> properties = new ArrayList<>();
|
|
|
|
|
|
|
|
public String getRelType() {
|
|
|
|
return relType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRelType(final String relType) {
|
|
|
|
this.relType = relType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSubRelType() {
|
|
|
|
return subRelType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSubRelType(final String subRelType) {
|
|
|
|
this.subRelType = subRelType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getRelClass() {
|
|
|
|
return relClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRelClass(final String relClass) {
|
|
|
|
this.relClass = relClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSource() {
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSource(final String source) {
|
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTarget() {
|
|
|
|
return target;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTarget(final String target) {
|
|
|
|
this.target = target;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<KeyValue> getProperties() {
|
|
|
|
return properties;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProperties(List<KeyValue> properties) {
|
|
|
|
this.properties = properties;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Boolean getValidated() {
|
|
|
|
return Objects.nonNull(validated) && validated;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setValidated(Boolean validated) {
|
|
|
|
this.validated = validated;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getValidationDate() {
|
|
|
|
return validationDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setValidationDate(String validationDate) {
|
|
|
|
this.validationDate = validationDate;
|
|
|
|
}
|
|
|
|
|
2023-01-31 14:36:13 +01:00
|
|
|
public List<Provenance> getProvenance() {
|
|
|
|
return provenance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProvenance(List<Provenance> provenance) {
|
|
|
|
this.provenance = provenance;
|
|
|
|
}
|
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
@Override
|
|
|
|
public boolean equals(Object o) {
|
|
|
|
if (this == o)
|
|
|
|
return true;
|
|
|
|
if (o == null || getClass() != o.getClass())
|
|
|
|
return false;
|
|
|
|
Relation relation = (Relation) o;
|
|
|
|
return relType.equals(relation.relType)
|
|
|
|
&& subRelType.equals(relation.subRelType)
|
|
|
|
&& relClass.equals(relation.relClass)
|
|
|
|
&& source.equals(relation.source)
|
|
|
|
&& target.equals(relation.target);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
2023-01-31 14:36:13 +01:00
|
|
|
return Objects.hash(relType, subRelType, relClass, source, target, provenance);
|
2021-04-23 12:15:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|