Reputation: 1
I’m looking for a cypher query to include in python module where I’m trying to delete a the nodes and sub nodes along with relationships of them if one specific node property matches. For example, if Node match I found is match (n) where n.name = ‘parent’ Then I want to delete all the nodes/relationships connected to that specific node along with sub-nodes and their relationships of those nodes I am trying to delete .
Sample Data : https://photos.app.goo.gl/5PPnNSLVRKvJzm6a8
So, basically I am looking for the query which will delete all the nodes(N1 to N8) after parents node (PN1) and associated relationships. So PN1 and rest of other nodes having incoming relationships will stay.
Upvotes: 0
Views: 315
Reputation: 886
Have you tried something like that:
MATCH (n)--(p)--(gp) WHERE n.name = 'parent' DETACH DELETE p, gp
Upvotes: 1