Here's the code I want to run:
with x,y,sourceNode,targetNode,r
CALL apoc.do.case([
x is not null and y is not null, 'CREATE (x)-[rels:ARC]->(y) SET rels = r',
x is not null and y is null, 'CREATE (x)-[rels:ARC]->(targetNode) SET rels = r',
x is null and y is not null, 'CREATE (sourceNode)-[rels:ARC]->(y) SET rels = r'
], '', {x:x, y:y, sourceNode:sourceNode, targetNode:targetNode, r:r}
) yield value
with value
match (n:Entity { processed:1}), (m:Entity { processed:0})
where n.label = m.label
detach delete (m)
The following part of the code doesn't execute:
match (n:Entity { processed:1}), (m:Entity { processed:0})
where n.label = m.label
detach delete (m)
Running this also doesn't throw any error. Upon researching I found out that apoc.do.case
must be followed by a return or an update statement. How do I get around this limitation and execute the above code in the exact order in a single query?