From 8b2043c7b1924d47cc9d5871649929ca0c437ff8 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 14 Apr 2020 16:43:40 +0200 Subject: [PATCH] introducing List generic container for Relation specific properties. Ref ticket https://issue.openaire.research-infrastructures.eu/issues/5512 --- .../eu/dnetlib/dhp/schema/oaf/Relation.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java index 6871c0197..3b45c4f7d 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Relation.java @@ -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 collectedFrom = new ArrayList<>(); + /** + * List of relation specific properties. Values values include 'similarityLevel', indicating the similarity score between a pair of publications. + */ + private List properties = new ArrayList<>(); + public String getRelType() { return relType; } @@ -68,6 +97,14 @@ public class Relation extends Oaf { this.collectedFrom = collectedFrom; } + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + public void mergeFrom(final Relation r) { checkArgument(Objects.equals(getSource(), r.getSource()),"source ids must be equal");