MATCH: Pattern Matching
()→ Node[]→ Edge-→ Undirected edge- Labels:
:Label - Properties:
{key: 'value', age: 30}
CREATE: Add Nodes & Edges
- Labels required for node creation
- No
RETURNclause - Use commas to create multiple items at once
MATCH + CREATE and MATCH + CREATE + RETURN
SET: Update Properties
- Always used with
MATCH, notCREATE - Creates the property if it does not already exist
- Use
COMMITto persist changes
WHERE: Filter nodes and edges by properties
To filter on node label:SKIP and LIMIT
ORDER BY
Joins and Cartesian Products
- Comma
,separates independent patterns - Shared variables between patterns create joins
- Unrelated patterns create cartesian products (N × M rows)
Property Match Operators
:→ exact match using property filter in node directly=→ exact match using property filter in WHERE clause
Boolean operators
-
OR -
AND
Comparison operators
-
Equal:
= -
Inequal:
<> -
Less than:
< -
Less than or equal to:
<= -
Greater than:
> -
Greater than or equal to:
>= -
is null:
IS NULL -
is not null:
IS NOT NULL
Data Types
| Type | Example |
|---|---|
| String | 'hello' or "hello" |
| Integer | age=30 |
| Boolean | flag=true |
| Double | score=3.14 |
| Embedding | emb=(1.2, 2.0, 0.0) |
RETURN Clause
- Select fields with
RETURN n.prop, m.prop
Expression evaluation
LOAD graphs
Load TuringDB graph
Files have to be available ingraphs subdirectory of turing-dir.
Load external data into TuringDB graph
Files have to be available indata subdirectory of turing-dir.
Procedures (CALL)
| Query | Description |
|---|---|
CALL db.labels() | All node labels |
CALL db.propertyTypes() | All node/edge property keys & types |
CALL db.edgeTypes() | All edge types |
CALL db.history() | Commit history |
CALL db.describeCommit('<hash>') | Counts for a single commit |
CALL db.procedures() | List available procedures |
CALL db.showIndexes() | List property indexes |
YIELDed and chained: CALL db.labels() YIELD label MATCH (n) WHERE n.name = label RETURN n.
DELETE
Variable-length paths
Graph algorithms
| Function | Description |
|---|---|
shortestPath(n, m, distanceProperty, distOutputVar, pathOutputVar) | Shortest path between nodes using the Dijkstra processor |
Functions
| Function | Description |
|---|---|
labels(n) | Node label as a string |
edgeType(e) | Edge type as a string |
toInteger(expr) | Parses a string as an integer |
toFloat(expr) | Parses a string as a float |
toBoolean(expr) | Parses a string as a boolean |
cosine_similarity(a, b) | Cosine similarity of two embeddings |
euclidean_distance(a, b) | Euclidean distance of two embeddings |
Aggregate Functions
| Function | Description |
|---|---|
count(expr) | Returns the number of non-null rows in the column corresponding to expr |
avg(expr) | Returns the average value of non-null rows in the numeric-valued column corresponding to expr |
Engine Commands
| Command | Description |
|---|---|
CREATE GRAPH <name> | Create a new named graph |
LOAD GRAPH <name> | Load an existing graph |
LOAD GML 'mygraph.gml' AS my_graph | Load the specified GML as TuringDB graph. Requires the GML to be accessible in TuringDB directory (-turing-dir, data subdir) |
LOAD JSONL 'mygraph.jsonl' AS my_graph | Load the specified JSONL as TuringDB graph. Requires the JSONL to be accessible in TuringDB directory (-turing-dir, data subdir) |
COMMIT | Persist intermediate state within a change (needed between separate node/edge create steps) |
LOAD COMMIT '<hash>' | Load a past commit into memory (needed for REST API queries on non-HEAD commits; CLI and SDK do this automatically) |
LIST GRAPH | List all available graphs |
HISTORY | Show commit history (versioning) |
CHANGE NEW | Create a new isolated change |
CHANGE SUBMIT | Merge current change into main |
CHANGE DELETE | Delete current change |
CHANGE LIST | List active uncommitted changes |
CREATE VECTOR INDEX <name> WITH DIMENSION <n> METRIC <COSINE|EUCLID> | Create a vector index |
VECTOR SEARCH IN <index> FOR <k> (<vec>) YIELD ids | k-nearest-neighbor vector search |
SHOW VECTOR INDEXES / DELETE VECTOR INDEX <name> | List / delete vector indexes |
CREATE INDEX <name> FOR (n) ON n.prop / FOR [e] ON e.prop | Create a property index (write; commit to take effect) |
DROP INDEX <name> | Drop a property or vector index |
MERGE_DATAPARTS | Compact the current graph’s DataParts into one |
INSTALL <ext> / SHOW EXTENSIONS / SHOW PROCEDURES | Load a procedure extension / list extensions / list procedures |
LOAD CSV "<file>" [WITH HEADERS] [ON ERROR SKIP|FAIL] AS row | Stream CSV rows (see CSV import) |

