How to Update or change value in cypher neo4j

agpt picture agpt · Jun 6, 2013 · Viewed 15.9k times · Source

Is there any update query in cypher using which we can update the property of any node or relationship ?
For e.g. I have following node and relationship:
NodeA-[r:relatedTo]-NodeB
where relatedTo is a relationship having properties like active or inactive

How can I change this property using cypher query ?

Answer

agpt picture agpt · Jun 6, 2013

using SET keyword in cypher query, see http://docs.neo4j.org/chunked/snapshot/query-set.html . (Since I have not came across any update query in cypher like in other RDBMS)

NodeA-[r:relatedTo]-NodeB
try to set value by : SET r.<your property name>="<desired value>"; before returning any value from start n=node(...)... return n; query.