98 lines
2.5 KiB
Java
98 lines
2.5 KiB
Java
|
|
package eu.dnetlib.dhp.eosc.model;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Objects;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.github.imifou.jsonschema.module.addon.annotation.JsonSchema;
|
|
|
|
/**
|
|
* 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 {
|
|
@JsonSchema(description = "The node source in the relation")
|
|
private String source;
|
|
|
|
@JsonSchema(description = "The node target in the relation")
|
|
private String target;
|
|
|
|
@JsonSchema(description = "To represent the semantics of a relation between two entities")
|
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
private RelType reltype;
|
|
|
|
@JsonSchema(description = "The reason why OpenAIRE holds the relation ")
|
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
private Provenance provenance;
|
|
|
|
@JsonSchema(description = "The result type of the target for this relation")
|
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
private String targetType;
|
|
|
|
public String getTargetType() {
|
|
return targetType;
|
|
}
|
|
|
|
public void setTargetType(String targetType) {
|
|
this.targetType = targetType;
|
|
}
|
|
|
|
public String getSource() {
|
|
return source;
|
|
}
|
|
|
|
public void setSource(String source) {
|
|
this.source = source;
|
|
}
|
|
|
|
public String getTarget() {
|
|
return target;
|
|
}
|
|
|
|
public void setTarget(String 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;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
|
|
return Objects.hash(source, target, reltype.getType() + ":" + reltype.getName());
|
|
}
|
|
|
|
public static Relation newInstance(String source, String target, RelType reltype, Provenance provenance) {
|
|
Relation relation = new Relation();
|
|
relation.source = source;
|
|
relation.target = target;
|
|
relation.reltype = reltype;
|
|
relation.provenance = provenance;
|
|
return relation;
|
|
}
|
|
|
|
public static Relation newInstance(String source, String target) {
|
|
Relation relation = new Relation();
|
|
relation.source = source;
|
|
relation.target = target;
|
|
|
|
return relation;
|
|
}
|
|
}
|