Property value to a label
The APOC library contains a procedure that can be used to create a label from a property value.
Procedure for creating a label from a property value
Qualified Name | Type |
---|---|
|
Procedure |
Example
The below example will further explain this procedure.
The following creates a
Movie
node with title
and genre
propertiesCREATE (:Movie {title: 'A Few Good Men', genre: 'Drama'})
The following moves the 'genre' property to a label and removes it as a property
MATCH (n:Movie)
CALL apoc.create.addLabels( id(n), [ n.genre ] )
YIELD node
REMOVE node.genre
RETURN node