2022-08-03 11:42:56 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.oa.model.graph;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
|
|
|
|
|
|
|
|
import eu.dnetlib.dhp.oa.model.Provenance;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To represent the gereric relation between two entities. It has the following parameters: - private Node source to
|
|
|
|
* represent the entity source of the relation - private Node target to represent the entity target of the relation -
|
|
|
|
* private RelType reltype to represent the semantics of the relation - private Provenance provenance to represent the
|
|
|
|
* provenance of the relation
|
|
|
|
*/
|
|
|
|
public class Relation implements Serializable {
|
2023-06-01 12:58:56 +02:00
|
|
|
@JsonSchema(description = "The identifier of the source in the relation")
|
|
|
|
private String source;
|
2022-08-03 11:42:56 +02:00
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
@JsonSchema(description = "The entity type of the source in the relation")
|
|
|
|
private String sourceType;
|
|
|
|
|
|
|
|
@JsonSchema(description = "The identifier of the target in the relation")
|
|
|
|
private String target;
|
|
|
|
|
|
|
|
@JsonSchema(description = "The entity type of the target in the relation")
|
|
|
|
private String targetType;
|
2022-08-03 11:42:56 +02:00
|
|
|
|
|
|
|
@JsonSchema(description = "To represent the semantics of a relation between two entities")
|
|
|
|
private RelType reltype;
|
|
|
|
|
|
|
|
@JsonSchema(description = "The reason why OpenAIRE holds the relation ")
|
|
|
|
private Provenance provenance;
|
|
|
|
|
|
|
|
@JsonSchema(
|
|
|
|
description = "True if the relation is related to a project and it has been collected from an authoritative source (i.e. the funder)")
|
|
|
|
private boolean validated;
|
|
|
|
|
|
|
|
@JsonSchema(description = "The date when the relation was collected from OpenAIRE")
|
|
|
|
private String validationDate;
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
public String getSource() {
|
2022-08-03 11:42:56 +02:00
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
public void setSource(String source) {
|
2022-08-03 11:42:56 +02:00
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
public String getSourceType() {
|
|
|
|
return sourceType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSourceType(String sourceType) {
|
|
|
|
this.sourceType = sourceType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTarget() {
|
2022-08-03 11:42:56 +02:00
|
|
|
return target;
|
|
|
|
}
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
public void setTarget(String target) {
|
2022-08-03 11:42:56 +02:00
|
|
|
this.target = target;
|
|
|
|
}
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
public String getTargetType() {
|
|
|
|
return targetType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTargetType(String targetType) {
|
|
|
|
this.targetType = targetType;
|
|
|
|
}
|
|
|
|
|
2022-08-03 11:42:56 +02:00
|
|
|
public RelType getReltype() {
|
|
|
|
return reltype;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setReltype(RelType reltype) {
|
|
|
|
this.reltype = reltype;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Provenance getProvenance() {
|
|
|
|
return provenance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProvenance(Provenance provenance) {
|
|
|
|
this.provenance = provenance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setValidated(boolean validate) {
|
|
|
|
this.validated = validate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getValidated() {
|
|
|
|
return validated;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setValidationDate(String validationDate) {
|
|
|
|
this.validationDate = validationDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getValidationDate() {
|
|
|
|
return validationDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
return Objects.hash(source, target, reltype.getType() + ":" + reltype.getName());
|
2022-08-03 11:42:56 +02:00
|
|
|
}
|
|
|
|
|
2023-06-01 12:58:56 +02:00
|
|
|
public static Relation newInstance(String source, String sourceType, String target, String targetType,
|
|
|
|
RelType reltype, Provenance provenance) {
|
2022-08-03 11:42:56 +02:00
|
|
|
Relation relation = new Relation();
|
|
|
|
relation.source = source;
|
2023-06-01 12:58:56 +02:00
|
|
|
relation.sourceType = sourceType;
|
2022-08-03 11:42:56 +02:00
|
|
|
relation.target = target;
|
2023-06-01 12:58:56 +02:00
|
|
|
relation.targetType = targetType;
|
2022-08-03 11:42:56 +02:00
|
|
|
relation.reltype = reltype;
|
|
|
|
relation.provenance = provenance;
|
|
|
|
return relation;
|
|
|
|
}
|
|
|
|
}
|