Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-14-2020 04:54 AM
I am using embedded neo4j. I want to implement functionality to update a one to many relationship
(n:LN) -[:r]-> (m:LM). It may be that for a given node (n:LN) there is a huge number of nodes (m:LM) related by [:r].
For a given node (n:LN) i want to perform one of two update operations:
For the Insert operation if expectNotExists is true and the relationship already exists than an error should be generated. If expectNotExists is false then a merge operation is performed. Similarly for 2.
Let's say that for a particular transaction there can be many nodes n and many operations on each such node. Implementing the cypher is possible, but also complicated. However using the api, this would be fairly simple. It would be even simpler if the Node interface had a hasRelationship(RelationshipType rt, Node n) method. There is no such method, but it can be implemented using calls to the getRelationships( Direction direction, RelationshipType types ) method. However that requires iterating through the results to find if a relationship exists.
My questions is not so much about how to form the cypher(although that isnt easy and may require multiple ones) but rather:
All the sessions of the conference are now available online