1
0
Fork 0

introducing List<KeyValue> generic container for Relation specific properties. Ref ticket https://issue.openaire.research-infrastructures.eu/issues/5512

This commit is contained in:
Claudio Atzori 2020-04-14 16:43:40 +02:00
parent 82e8341f50
commit 8b2043c7b1
1 changed files with 37 additions and 0 deletions

View File

@ -6,20 +6,49 @@ import java.util.stream.Stream;
import static com.google.common.base.Preconditions.checkArgument; 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 { public class Relation extends Oaf {
/**
* Main relationship classifier, values include 'resultResult', 'resultProject', 'resultOrganization', etc.
*/
private String relType; private String relType;
/**
* Further classifies a relationship, values include 'affiliation', 'similarity', 'supplement', etc.
*/
private String subRelType; private String subRelType;
/**
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges, 'isMergedIn'.
*/
private String relClass; private String relClass;
/**
* The source entity id.
*/
private String source; private String source;
/**
* The target entity id.
*/
private String target; private String target;
/**
* The list of datasource id/name pairs providing this relationship.
*/
private List<KeyValue> collectedFrom = new ArrayList<>(); 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() { public String getRelType() {
return relType; return relType;
} }
@ -68,6 +97,14 @@ public class Relation extends Oaf {
this.collectedFrom = collectedFrom; this.collectedFrom = collectedFrom;
} }
public List<KeyValue> getProperties() {
return properties;
}
public void setProperties(List<KeyValue> properties) {
this.properties = properties;
}
public void mergeFrom(final Relation r) { public void mergeFrom(final Relation r) {
checkArgument(Objects.equals(getSource(), r.getSource()),"source ids must be equal"); checkArgument(Objects.equals(getSource(), r.getSource()),"source ids must be equal");