Skip to content

Operators & functions

The v0 surface covers every operator and built-in function listed in RFC-004 plus a couple of additions from later releases (vector(), shortestPath, allShortestPaths).

Operators

Arithmetic

+, -, *, /, % (modulo), ^ (power).

RETURN 2 + 3 AS a, 10 % 3 AS b, 2 ^ 10 AS c

String

  • + concatenates strings.
  • =~ is the regex match operator (PCRE-style).
RETURN p.first_name + ' ' + p.last_name AS full_name
MATCH (p:Person) WHERE p.email =~ '.+@example\\.com$' RETURN p

Boolean

AND, OR, NOT, XOR. Three-valued logic — see Supported subset § NULL semantics.

Comparison

=, <>, <, <=, >, >=. Equality and ordering follow the Cypher rules; = between NULL and anything returns NULL, not false.

Null tests

IS NULL, IS NOT NULL.

MATCH (p:Person)
WHERE p.country IS NOT NULL
RETURN p.name, p.country

Membership and string predicates

  • x IN [...] — list membership.
  • s STARTS WITH 'A', s ENDS WITH '!', s CONTAINS 'lic' — string predicates.
MATCH (p:Person)
WHERE p.country IN ['US', 'CA', 'MX']
AND p.name STARTS WITH 'A'
RETURN p

CASE

Simple and multi-branch forms both parse.

RETURN CASE
WHEN p.age < 18 THEN 'minor'
WHEN p.age < 65 THEN 'adult'
ELSE 'senior'
END AS bracket

List and pattern comprehension

RETURN [x IN $values WHERE x > 0 | x * 2] AS doubled_positives
MATCH (p:Person)
RETURN p.name, [(p)-[:KNOWS]->(f) | f.name] AS friend_names

Built-in functions

Aggregations

FunctionDescription
count(*)Row count.
count(x)Non-null count of x.
count(DISTINCT x)Distinct non-null count.
sum(x)Sum.
avg(x)Arithmetic mean.
min(x) / max(x)Minimum / maximum.
collect(x)Accumulate rows into a list.
collect(DISTINCT x)Same, deduplicated.

Scalar

FunctionDescription
id(n)Internal NodeId for a node, or edge id for a rel.
labels(n)List of label strings on a node.
type(r)The edge type string of a relationship.
keys(n)List of property names declared on a node / rel.
properties(n)The property map of a node / rel as a MAP<STRING, T>.
length(p)Number of hops in a PATH.
size(coll)Length of a list, map or string.
head(coll)First element of a list.
last(coll)Last element of a list.
tail(coll)The list minus its first element.
coalesce(x, …)First non-null argument, or NULL if every arg is null.

String

toLower(s), toUpper(s), trim(s), substring(s, start[, length]), replace(s, find, repl), split(s, sep), toString(x), toInteger(x), toFloat(x).

RETURN toLower(trim(p.email)) AS normalized

Numeric

abs(x), ceil(x), floor(x), round(x), rand(), sign(x).

Temporal (constructors only)

date(iso), datetime(iso), duration(iso). The constructor accepts ISO-8601 strings; full temporal algebra is out of scope in v0.

WITH datetime('2026-01-15T12:00:00Z') AS cutoff
MATCH (m:Message)
WHERE m.created_at >= cutoff
RETURN m

Pattern

FunctionDescription
exists(pattern)True if at least one binding for the pattern exists.
nodes(path)Nodes along a PATH (alternating positions 0, 2, 4, …).
relationships(path)Relationships along a PATH (positions 1, 3, 5, …).

EXISTS { ... } subqueries are documented in Reading data.

Path constructors

shortestPath((a)-[*..N]-(b)) and allShortestPaths((a)-[*..N]-(b)) (RFC-023, [Unreleased]). The path binding is required and both endpoints must be bound in scope. Single relationship hop in the inner pattern.

MATCH p = shortestPath((a:Person {name: 'Alice'})-[:KNOWS*..6]-(b:Person {name: 'Bob'}))
RETURN p, length(p) AS hops

vector() (since 0.4.1)

Lifts a homogeneous numeric list (literal or parameter) into a first-class VECTOR(Vec<f32>). Integers are coerced to f32. Non-numeric or non-list arguments raise a typed EvalError naming the offending index.

CREATE (d:Doc {id: $id, embedding: vector($values)})

Bare list literals (e.g. embedding: [0.1, 0.2]) still fail with only scalars are storable in v0; vector() is the explicit opt-in for storage.

What’s next