Transforming nodes and relationships

In this section, we will discuss updating labels, properties, and relationships.

Updating node properties

The properties of a node are modified by using the following Cypher statement:

MATCH (f:FEMALE {name: "Sheena"})
SET f.surname = "Foster"
return f;

The preceding statement will find the node Sheena and will add or update (if it already exists) the property surname with a new or modified value. For removing the property, just replace the SET statement in the preceding Cypher query with SET f.surname = NULL. We can also set multiple properties by separating them with a comma.

The REMOVE statement is another construct provided by Cypher for removing the properties of a node. For example, we can also execute the ...

Get Building Web Applications with Python and Neo4j now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.