introducing List<KeyValue> generic container for Relation specific properties. Ref ticket https://issue.openaire.research-infrastructures.eu/issues/5512
This commit is contained in:
parent
82e8341f50
commit
8b2043c7b1
|
@ -6,20 +6,49 @@ import java.util.stream.Stream;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
/**
|
||||
* Relation aims to model 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 throught 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.
|
||||
*/
|
||||
public class Relation extends Oaf {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The list of datasource id/name pairs providing this relationship.
|
||||
*/
|
||||
private List<KeyValue> collectedFrom = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* List of relation specific properties. Values values include 'similarityLevel', indicating the similarity score between a pair of publications.
|
||||
*/
|
||||
private List<KeyValue> properties = new ArrayList<>();
|
||||
|
||||
public String getRelType() {
|
||||
return relType;
|
||||
}
|
||||
|
@ -68,6 +97,14 @@ public class Relation extends Oaf {
|
|||
this.collectedFrom = collectedFrom;
|
||||
}
|
||||
|
||||
public List<KeyValue> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<KeyValue> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public void mergeFrom(final Relation r) {
|
||||
|
||||
checkArgument(Objects.equals(getSource(), r.getSource()),"source ids must be equal");
|
||||
|
|
Loading…
Reference in New Issue