Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add label to existing node with Cypher

Tags:

neo4j

cypher

How can I add a label to an existing node using a Cypher query?

like image 609
cheesetaco Avatar asked Feb 07 '14 10:02

cheesetaco


People also ask

What Cypher keyword do you use to add property to an existing node?

The property mutation operator += can be used with SET to mutate properties from a map in a fine-grained fashion: Any properties in the map that are not on the node or relationship will be added.

Can u relabel node in Neo4j?

You can change the nodes associated with a label but you can't change the type of a relationship.

How do you create a relationship between existing nodes in Neo4j?

In this scenario, we are going to use two existing nodes : CreditCard and Customer to create a Relationship with properties. That means, our Neo4J Database should have these two nodes. We use CQL MATCH command to retrieve existing two nodes and CQL CREATE command to create new Relationship between them.


1 Answers

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 
like image 63
Stefan Armbruster Avatar answered Oct 14 '22 23:10

Stefan Armbruster