How can I add a label to an existing node using a Cypher query?
Asked
Active
Viewed 3.4k times
1 Answers
100
That's in the reference docs, see http://docs.neo4j.org/chunked/stable/query-set.html#set-set-a-label-on-a-node, you need to use set
to a add a label to a existing node:
match (n {id:desired-id})
set n :newLabel
return n

Pavan Kumar Varma
- 1,413
- 1
- 14
- 22

Stefan Armbruster
- 39,465
- 6
- 87
- 97
-
6If you want to add a label to all nodes with another label, just do `match (n:ExistingLabel) set n :NewLabel`. The existing label is not removed. – ADTC May 12 '16 at 02:31
-
7Old labels can be removed using: `match (n:OldLabel) remove n:OldLabel` – Thomas Bindzus Sep 16 '17 at 10:43