The SET statement allows you to set properties and labels on nodes and edges. These nodes or edges must first be retrieved using the MATCH statement.
Note: The unique identifier _id is immutable.

GQLINSERT (rowlock:User {_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)
To update the value of each specified property:
GQLMATCH (n:User {name: 'rowlock'})-[e:Follows]->(:User {name: 'Brainy'}) SET n.gender = 'male', e.createdOn = date('2024-01-07') RETURN n.gender, e.createdOn
To remove the value of a property by setting it to null:
GQLMATCH (n:User {name: 'mochaeach'}) SET n.gender = null
You can replace all properties (except _id) of a node or edge using a record. Any property included in the record will be updated, while all other properties will be set to null (closed graph) or removed (open graph).
GQLMATCH (n:User {name: 'purplechalk'}) SET n = {name: 'MasterSwift'} RETURN n
To remove all property values by setting an empty record:
GQLMATCH (n:User {name: 'rowlock'}) SET n = {} RETURN n
To add one label to a node:
GQLMATCH (n:User {name: 'rowlock'}) SET n:Player
To add multiple labels to a node:
GQLMATCH (n:User {name: 'rowlock'}) SET n:Player, n:Employee
To update labels of FOLLOWS edges to Links (each edge has up to one label):
GQLMATCH ()-[e:Follows]->() SET e:Links
NOTETo remove labels from nodes or edges, use the REMOVE statement.