Every built-in Cypher function relate ships, by category, with its signature, what it returns and a note on edge cases, each checked against the engine.
cypher
The cells on this page run in your browser. Press Run to load the engine (2.3 MB); earlier cells run first. The recorded results are from relate 0.1.2.Open in playground
relate ships 194 function signatures under 176 names, the rows SHOW FUNCTIONS returns, plus six more behind preview opt-ins. This page lists each one by category with its signature as SHOW FUNCTIONS prints it, what it returns, and a note on the edge cases. A row that differs from its catalog signature says so. Rows that name several functions (the trigonometric, hyperbolic, clock and *.truncate rows), the format(value :: …, pattern :: STRING) row, and the [, pattern :: STRING] form of the GQL temporal names each condense several catalog signatures into one. The cells run on relate's WebAssembly (WASM) build, which runs the same engine as the CLI and the clients.
These functions read a nodeAn entity in the graph: it carries zero or more labels and a map of properties, and relationships connect it to other nodes.Read more in the glossary, a relationshipA directed, typed connection between two nodes, with properties of its own; every relationship has exactly one type and a start and an end node.Read more in the glossary or a pathAn alternating sequence of nodes and relationships that a pattern matched, bound with p = … and read with nodes(p), relationships(p) and length(p).Read more in the glossary: its labels or type, its propertyA named value stored on a node or relationship, such as name: 'Ada'; values are scalars, temporal and spatial values, vectors, or lists of them.Read more in the glossary, its end nodes and its element idThe string elementId() returns for a node or relationship, such as 4:relate-neo4j:n0; it stays the same when the store is closed and opened again.Read more in the glossary.
Signature
Returns
Notes
elementId(input :: NODE | RELATIONSHIP) :: STRING
The element id
4:relate-neo4j:n<k> for a node, 5:relate-neo4j:r<k> for a relationship in the neo4j namespace
id(input :: NODE | RELATIONSHIP) :: INTEGER
The integer id
Deprecated; the catalog names elementId as the replacement
MATCH p = (a:Person {name: 'Ada'})-[r:WORKS_ON]->(proj)RETURN labels(a) AS labels, type(r) AS type, keys(a) AS keys, properties(r) AS props, endNode(r).name AS ends_at, length(p) AS hops, size(nodes(p)) AS path_nodes, db.nameFromElementId(elementId(a)) AS namespace
Keys in a map, elements in a list, nodes plus relationships in a path
A one-hop path gives 3
char_length(input :: STRING) :: INTEGER
Characters in a string
GQL name
character_length(input :: STRING) :: INTEGER
Characters in a string
GQL name
head(list :: LIST<ANY>) :: ANY
The first element
null for an empty list
last(list :: LIST<ANY>) :: ANY
The last element
null for an empty list
linenumber() :: INTEGER
The line LOAD CSV is reading
Listed by SHOW FUNCTIONS; a call fails with syntax error: UnknownFunction: unknown function linenumber(), inside LOAD CSV too
file() :: STRING
The file LOAD CSV is reading
Listed by SHOW FUNCTIONS; a call fails with syntax error: UnknownFunction: unknown function file(), inside LOAD CSV too
Cypher
RETURN coalesce(null, 'fallback') AS first, nullIf(1, 1) AS same, valueType(1.5) AS type, size('café') AS chars, cardinality({a: 1, b: 2}) AS keys, head([]) AS empty_head
Recorded result
first
same
type
chars
keys
empty_head
"fallback"
null
"FLOAT NOT NULL"
4
2
null
1 row
| first | same | type | chars | keys | empty_head |
|------------|------|------------------|-------|------|------------|
| "fallback" | null | "FLOAT NOT NULL" | 4 | 2 | null |
1 row
Conversion functions
Signature
Returns
Notes
toString(input :: ANY) :: STRING
The value as a string
Maps, lists and graph values render in display form ({a: 1}). A list literal fails at compile time with syntax error: InvalidArgumentValue: toString(); a list in a variable or property converts
A float truncates toward zero; a string parses decimal, hexadecimal ('0x1F'), octal and _ forms. A BOOLEAN argument fails with type error: InvalidArgumentValue: toInteger(), although the catalog lists it. A string outside the range fails with NumberOutOfRange
RETURN toString({a: 1}) AS display, toInteger(-3.9) AS truncated, toInteger('0x1F') AS hex, toIntegerOrNull('x') AS bad_int, toBoolean('TRUE') AS bool, toBoolean('yes') AS not_bool, toIntegerList(['1', 'x']) AS ints, toFloatList(vector([1, 2], 2, INT8)) AS from_vector
string.indexOf(input :: STRING, value :: STRING) :: INTEGER
The zero-based index of the first occurrence
-1 when absent
Cypher
RETURN toUpper('relate') AS upper, trim(BOTH 'x' FROM 'xxadaxx') AS trimmed, replace('banana', 'a', 'o', 2) AS limited, substring('opencypher', 4, 6) AS sub, split('a,b;c', [',', ';']) AS parts, string.join(['Ada', 'Grace'], ' & ') AS joined, string.regexReplace('v0.16.1', '[0-9]+', 'N') AS masked, string.indexOf('relate', 'l') AS at
asinh, acosh and atanh are not functions in relate
haversin(input :: FLOAT) :: FLOAT
Half the versine
—
degrees(input :: FLOAT) :: FLOAT
Radians to degrees
—
radians(input :: FLOAT) :: FLOAT
Degrees to radians
—
An integer argument where the signature says FLOAT is widened: sqrt(16) is 4.0.
Cypher
RETURN abs(-5) AS abs, ceil(4.2) AS ceil, round(-2.5) AS half_up, round(2.5, 0, 'HALF_EVEN') AS half_even, sign(-3) AS sign, sqrt(16) AS root, log10(1000) AS log10, degrees(pi()) AS degrees, rand() >= 0 AND rand() < 1 AS rand_in_range
Each instant constructor takes an optional argument: a string, a map, another temporal value to convert, or nothing for the current instant. The pattern argument parses the string with a format pattern.
date.truncate('month', date('2026-11-08')) is 2026-11-01. datetime.truncate, localdatetime.truncate, time.truncate and localtime.truncate work the same way
Map keys: years, months, weeks, days, hours, minutes, seconds and smaller units; duration({weeks: 2}) is P14D
duration.between(from :: ANY, to :: ANY) :: DURATION
The difference in months, days, and seconds
Negative when to is earlier: PT-1H-30M
duration.inMonths(from :: ANY, to :: ANY) :: DURATION
The difference in whole months
—
duration.inDays(from :: ANY, to :: ANY) :: DURATION
The difference in whole days
—
duration.inSeconds(from :: ANY, to :: ANY) :: DURATION
The difference in seconds
—
duration_between(from :: ANY, to :: ANY) :: DURATION
Same as duration.between
GQL name
format(value :: DATE | LOCAL TIME | ZONED TIME | LOCAL DATETIME | ZONED DATETIME | DURATION) :: STRING
The ISO 8601 form
—
format(value :: …, pattern :: STRING) :: STRING
The value formatted with a pattern
format(date('2026-11-08'), 'dd/MM/yyyy') is '08/11/2026'
Cypher
RETURN date({year: 2026, week: 45, dayOfWeek: 7}) AS from_week, date.truncate('month', date('2026-11-08')) AS month_start, duration.inDays(date('2026-01-01'), date('2026-11-08')) AS days, datetime.fromepochmillis(1000) AS epoch, format(date('2026-11-08'), 'dd/MM/yyyy') AS formatted, datetime() IS NOT NULL AS now_works
The similarity functions take a vector or a plain list in each position. Arguments of different lengths fail with type error: InvalidArgumentValue: vectors must have same dimensions, and a null argument gives null.
Cypher
WITH vector([0, 0], 2, INT8) AS origin, vector([3, 4], 2, INT8) AS vRETURN vector.similarity.cosine([1, 0], [0, 1]) AS cosine, vector.similarity.euclidean([0, 0], [3, 4]) AS euclidean, vector_distance(origin, v, EUCLIDEAN) AS distance, vector_distance(origin, v, MANHATTAN) AS manhattan, vector_norm(v, EUCLIDEAN) AS norm, vector_dimension_count(v) AS dims
WITH uuid('f066ecfc-5151-4121-8a36-b35e00d72918') AS uRETURN toString(u) AS text, uuid.mostSignificantBits(u) AS high, uuid(0, 1) AS from_halves
Recorded result
text
high
from_halves
"f066ecfc-5151-4121-8a36-b35e00d72918"
-1123950488542166751
"00000000-0000-0000-0000-000000000001"
1 row
| text | high | from_halves |
|----------------------------------------|----------------------|----------------------------------------|
| "f066ecfc-5151-4121-8a36-b35e00d72918" | -1123950488542166751 | "00000000-0000-0000-0000-000000000001" |
1 row
Aggregating functions
An aggregating function reduces the rows of a group to one value; the other items of the RETURN or WITH are the grouping keys. DISTINCT before the argument aggregates each distinct value once, and ALL is the default.
MATCH (p:Person)-[w:WORKS_ON]->(proj:Project)RETURN proj.name AS project, count(*) AS people, collect(p.name) AS names, min(w.since) AS first, avg(w.since) AS mean, percentileDisc(w.since, 0.5) AS medianORDER BY project
Takes a pattern: exists((a)-[:KNOWS]->()). The property form exists(n.prop) fails with syntax error: InvalidPropertyExistence: the property existence syntax `exists(variable.property)` is no longer supported. Please use `variable.property IS NOT NULL` or `property_exists(...)` instead
The key is written as a name, property_exists(n, age); a string literal fails with syntax error: parse error: PROPERTY_EXISTS() second argument must be a property name identifier
Cypher
MATCH (p:Person {name: 'Grace'})RETURN exists((p)-[:WORKS_ON]->()) AS works, property_exists(p, role) AS has_role, property_exists(p, email) AS has_email, isEmpty([]) AS empty, all(x IN [2023, 2022] WHERE x > 2020) AS all_recent
As MATCH p = shortestPath(…), the same forms return one row per path; patterns covers them and the SHORTEST path selector.
Cypher
MATCH (a:Person {name: 'Ada'}), (t:Project {name: 'opencypher-tck'})RETURN length(shortestPath((a)-[*]-(t))) AS hops, size(allShortestPaths((a)-[*]-(t))) AS paths
Recorded result
hops
paths
2
1
1 row
| hops | paths |
|------|-------|
| 2 | 1 |
1 row
Graph reference functions
Signature
Returns
Notes
graph.names() :: LIST<STRING>
The graphs of a composite database
Fails in relate, which has no composite databases: semantic error: SemanticError: Dynamic graph lookup not allowed here. This feature is only available on composite databases. Attempted to access graph <call>, where <call> is the call as written, such as graph.names()
These functions are off until RELATE_PREVIEW names their feature, and SHOW FUNCTIONS lists them only then. Off, a call fails with syntax error: UnknownFunction: unknown function <name>(). The WASM build has no process environment, so it cannot turn them on.