added hashCode to relation to avoid to produce multiple identical relations

This commit is contained in:
Miriam Baglioni 2020-07-29 16:54:16 +02:00
parent b71d12cf26
commit 6a499c6b7a
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@
package eu.dnetlib.dhp.schema.dump.oaf.graph; package eu.dnetlib.dhp.schema.dump.oaf.graph;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
import eu.dnetlib.dhp.schema.dump.oaf.Provenance; import eu.dnetlib.dhp.schema.dump.oaf.Provenance;
@ -42,4 +43,10 @@ public class Relation implements Serializable {
public void setProvenance(Provenance provenance) { public void setProvenance(Provenance provenance) {
this.provenance = provenance; this.provenance = provenance;
} }
@Override
public int hashCode() {
return Objects.hash(source.getId(), target.getId(), reltype.getType() + ":" + reltype.getName());
}
} }