Skip to main content

MATCH: Pattern Matching

  • () → Node
  • [] → Edge
  • - → Undirected edge
  • Labels: :Label
  • Properties: {key: 'value', age: 30}

CREATE: Add Nodes & Edges

  • Labels required for node creation
  • No RETURN clause
  • Use commas to create multiple items at once

MATCH + CREATE and MATCH + CREATE + RETURN

SET: Update Properties

  • Always used with MATCH, not CREATE
  • Creates the property if it does not already exist
  • Use COMMIT to persist changes

WHERE: Filter nodes and edges by properties

To filter on node label:
To filter on node property:
To filter on edge label:
To filter on edge property:

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

RETURN Clause

  • Select fields with RETURN n.prop, m.prop

Expression evaluation

LOAD graphs

Load TuringDB graph

Files have to be available in graphs subdirectory of turing-dir.

Load external data into TuringDB graph

Files have to be available in data subdirectory of turing-dir.

Procedures (CALL)

Procedure outputs can be YIELDed and chained: CALL db.labels() YIELD label MATCH (n) WHERE n.name = label RETURN n.

DELETE

Variable-length paths

Graph algorithms

Functions

Aggregate Functions

Engine Commands

UNWIND

Property indexes

Useful Patterns