I separate my Neo4j database into isolated sub-databases using labels. During development, I frequently need to wipe an entire sub-database clean. Currently I do this with:
MATCH (n:myLabel)-[r]-() DELETE n, r
MATCH (n:myLabel) DELETE n
I need two queries because I have to delete all relationships, at the same time as their nodes, but I don't know how to match unconnected nodes simultaneously. Is there a way to wipe out a whole subgraph marked by a label in a single query? I'm on Neo4j 2.2.1