I have two nodes between which, same edge with same property is being created over and over again. How can I avoid this? If the edges have different properties, its ok and it needs to be kept but if the properties are same, there should be one edge only.
EDIT: I'm using rails and I want to do this through application and not Cypher query.
EDIT: Sharing some code for relevance:
dis = Disease.where(disease: params[:disease]).first
fac = Factor.where(factor: params[:factor])
dis.factors.create(fac, prop: "p1")
So, what I want is if I input same disease and factor, it not duplicate the edge (which it is currently doing) as property being set is also same. However, if in future, this p1
changes to p2
, then the edge should be added.
Refer post Neo4j inconsistent behaviour of model classes for model classes (Disease and factor).