I would like to duplicate every node in my graph by using foreach loop. I try to use if/else statement to create specific kind of node - (:Node) if n:Node has 'Node' label and (:Road) if r:Road has 'Road label. How to fix this query?
MATCH p=((n:Node)-[:STARTS]-(r:Road)-[:ENDS]-(z:Node))
FOREACH (x in nodes(p) |
WITH CASE head(labels(x))
WHEN 'Node'
THEN
CREATE (:Node {name : x.name, subID : ID(x)})
ELSE
CREATE (:Road {name : x.name, subID : ID(x)}))
Aucun commentaire:
Enregistrer un commentaire