Overview
The REMOVE
statement allows you to remove properties and labels on nodes and edges. These nodes or edges must first be retrieved using the MATCH
statement.
Currently, the
REMOVE
statement only supports open graphs.
Example Graph

CREATE GRAPH myGraph ANY
INSERT (rowlock:User&Person&Player&Employee {_id: "U01", name: "rowlock"}),
(brainy:User {_id: "U02", name: "Brainy", gender: "male"}),
(purplechalk:User {_id: "U03", name: "purplechalk", gender: "female"}),
(mochaeach:User {_id: "U04", name: "mochaeach", gender: "female"}),
(c:Club {_id: "C01"}),
(rowlock)-[:Follows {createdOn: date("2024-01-05")}]->(brainy),
(purplechalk)-[:Follows {createdOn: date("2024-02-01")}]->(brainy),
(mochaeach)-[:Follows {createdOn: date("2024-02-10")}]->(brainy),
(brainy)-[:Joins {memberNo: 1}]->(c)
Removing Labels
To remove a label from a node:
MATCH (n:User {name: 'rowlock'})
REMOVE n:Person
To remove two labels from a node:
MATCH (n:User {name: 'rowlock'})
REMOVE n:Player, n:Employee
Removing Properties
To remove the specified properties:
MATCH (n:User {name: 'rowlock'})-[e:Follows]->(:User {name: 'Brainy'})
REMOVE n.gender, e.createdOn