Suppose I have the following code:
link = neo4j.Path(this_node,"friends",friend_node) #create a link between 2 nodes
link.create(graph_db) #add the link aka the 'path' to the database
But let's say later I call:
link2 = neo4j.Path(friend_node,"friends",this_node)
link2.create_or_fail(graph_db)
Basically, link.create_or_fail()
would be a function that either adds the link2 path to the database or it fails if a path already exists.
In this case, when I called link = neo4j.Path(this_node,"friends",friend_node)
, I already created a path between this_node
and friend_node
so link2.create_or_fail(graph_db)
should do nothing. Is such a function possible?