Website | Source

Core syntax


Key verbs:
* CREATE: construct new instances of nodes, relationships, constraints
* DELETE: deconstruct a node, but will refuse if the node is linked via relationships; MATCH (n) DELETE n will delete any nodes but cleanly aborts if it leaves relationships dangling; MATCH ()-[r]->() DELETE r deletes any relationships (I think?)
* DETACH DELETE: delete nodes and any relationships attached; MATCH (n) DETACH DELETE n effectively empties the database
* MATCH: compare user-defined patterns to the underlying graph/datastore; MATCH (n) RETURN n is the "find all nodes and return them", like a SELECT * FROM * kind of super-query; MATCH ()-[r]->() matches any relationships (I think?)
* MERGE: a mix of MATCH and CREATE it will either match whole patterns or create new record that match the pattern in its entirety.
* RETURN: return the set of nodes to the query caller
* SET: add/update an attribute on a node/relationship
* REMOVE: remove an attribute on a node/relationship

Random notes

Nodes can have zero-to-many labels

Tags: language   storage   graph  

Last modified 19 May 2023