From 6a499c6b7ab741041ab24daf986627a02f13ed72 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Wed, 29 Jul 2020 16:54:16 +0200 Subject: [PATCH] added hashCode to relation to avoid to produce multiple identical relations --- .../eu/dnetlib/dhp/schema/dump/oaf/graph/Relation.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Relation.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Relation.java index 9fb5ea2df1..664910f04a 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Relation.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/Relation.java @@ -2,6 +2,7 @@ package eu.dnetlib.dhp.schema.dump.oaf.graph; import java.io.Serializable; +import java.util.Objects; import eu.dnetlib.dhp.schema.dump.oaf.Provenance; @@ -42,4 +43,10 @@ public class Relation implements Serializable { public void setProvenance(Provenance provenance) { this.provenance = provenance; } + + @Override + public int hashCode() { + + return Objects.hash(source.getId(), target.getId(), reltype.getType() + ":" + reltype.getName()); + } }