2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.schema.dump.oaf.graph;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
2021-11-18 09:16:59 +01:00
|
|
|
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
|
2021-11-18 11:01:44 +01:00
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
import eu.dnetlib.dhp.schema.dump.oaf.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 {
|
2021-11-18 09:16:59 +01:00
|
|
|
@JsonSchema(description = "The node source in the relation")
|
2021-04-23 12:15:36 +02:00
|
|
|
private Node source;
|
2021-11-18 09:16:59 +01:00
|
|
|
|
|
|
|
@JsonSchema(description = "The node target in the relation")
|
2021-04-23 12:15:36 +02:00
|
|
|
private Node target;
|
2021-11-18 09:16:59 +01:00
|
|
|
|
|
|
|
@JsonSchema(description = "To represent the semantics of a relation between two entities")
|
2021-04-23 12:15:36 +02:00
|
|
|
private RelType reltype;
|
2021-11-18 09:16:59 +01:00
|
|
|
|
|
|
|
@JsonSchema(description = "The reason why OpenAIRE holds the relation ")
|
2021-04-23 12:15:36 +02:00
|
|
|
private Provenance provenance;
|
2021-11-18 09:16:59 +01:00
|
|
|
|
|
|
|
@JsonSchema(description = "True if the relation is related to a project and it has been collected from an authoritative source (i.e. the funder)")
|
2021-08-06 14:31:35 +02:00
|
|
|
private boolean validated;
|
2021-11-18 09:16:59 +01:00
|
|
|
|
|
|
|
@JsonSchema(description = "The date when the relation was collected from OpenAIRE")
|
|
|
|
private String validationDate;
|
2021-04-23 12:15:36 +02:00
|
|
|
|
|
|
|
public Node getSource() {
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSource(Node source) {
|
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Node getTarget() {
|
|
|
|
return target;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTarget(Node target) {
|
|
|
|
this.target = target;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-08-06 14:31:35 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-11-18 09:16:59 +01:00
|
|
|
|
2021-04-23 12:15:36 +02:00
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
|
|
|
|
return Objects.hash(source.getId(), target.getId(), reltype.getType() + ":" + reltype.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Relation newInstance(Node source, Node target, RelType reltype, Provenance provenance) {
|
|
|
|
Relation relation = new Relation();
|
|
|
|
relation.source = source;
|
|
|
|
relation.target = target;
|
|
|
|
relation.reltype = reltype;
|
|
|
|
relation.provenance = provenance;
|
|
|
|
return relation;
|
|
|
|
}
|
|
|
|
}
|