Docs
View as markdown

Functions

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

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.

CategoryFunctions
Graph element functionselementId, id, labels, type, keys, properties, startNode, endNode, nodes, relationships, length, path_length, db.nameFromElementId
Scalar functionscoalesce, nullIf, valueType, size, cardinality, char_length, character_length, head, last, linenumber, file
Conversion functionstoString, toStringOrNull, toInteger, toIntegerOrNull, toFloat, toFloatOrNull, toBoolean, toBooleanOrNull, toStringList, toIntegerList, toFloatList, toBooleanList
String functionstoUpper, upper, toLower, lower, trim, ltrim, rtrim, btrim, normalize, replace, substring, left, right, split, reverse, string.join, string.regexReplace, string.indexOf
List functionstail, reverse, range, reduce, coll.flatten, coll.sort, coll.indexOf, coll.insert, coll.remove, coll.max, coll.min, coll.distinct
Math functionsabs, ceil, ceiling, floor, round, sign, rand, isNaN, sqrt, exp, log, ln, log10, e, pi, and the trigonometric functions
Temporal functionsdate, time, localtime, datetime, localdatetime, their GQL names, duration, duration.*, *.truncate, *.realtime, *.statement, *.transaction, datetime.fromepoch*, format, timestamp
Spatial functionspoint, point.distance, point.withinBBox
Vector functionsvector, vector.similarity.cosine, vector.similarity.euclidean, vector_distance, vector_norm, vector_dimension_count
UUID functionsuuid, randomUUID, uuid.mostSignificantBits, uuid.leastSignificantBits
Aggregating functionscount, sum, avg, min, max, collect, stDev, stDevP, percentileCont, percentileDisc, and their GQL names
Predicate functionsall, any, none, single, allReduce, exists, isEmpty, property_exists
Path functionsshortestPath, allShortestPaths
Graph reference functionsgraph.names, graph.byName, graph.byElementId, graph.propertiesByName
Preview functionscoll.zip, coll.hasAnyOf, coll.hasAllOf, coll.hasNoneOf, stddev_samp, stddev_pop

Synopsis

<name>(<argument>, …)
<namespace>.<name>(<argument>, …)
SHOW FUNCTIONS [YIELD <column>, …] [WHERE <predicate>] [RETURN …]
RuleDetail
NamesCase-insensitive: TOUPPER('a') and toUpper('a') are the same call
null argumentsA scalar function given null returns null, unless its row says otherwise
Unknown namesyntax error: UnknownFunction: unknown function <name>()
Wrong aritysyntax error: InvalidNumberOfArguments: <name>() …, for example coalesce() requires at least one argument, got 0
SHOW FUNCTIONS columnsname, category, description, signature, isBuiltIn, argumentDescription, returnDescription, aggregating, isDeprecated, deprecatedBy
Deprecated functionsUnder EXPLAIN, a call raises notification 01N01 with the replacement (notifications)
Cypher
SHOW FUNCTIONS YIELD name, category, signature
WHERE name STARTS WITH 'vector'
RETURN name, category, signature ORDER BY name
Recorded result
namecategorysignature
"vector""Scalar""vector(vectorValue :: STRING | LIST<INTEGER | FLOAT>, dimension :: INTEGER, coordinateType :: [INTEGER64, INTEGER32, INTEGER16, INTEGER8, FLOAT64, FLOAT32]) :: VECTOR"
"vector.similarity.cosine""Vector""vector.similarity.cosine(a :: VECTOR | LIST<INTEGER | FLOAT>, b :: VECTOR | LIST<INTEGER | FLOAT>) :: FLOAT"
"vector.similarity.euclidean""Vector""vector.similarity.euclidean(a :: VECTOR | LIST<INTEGER | FLOAT>, b :: VECTOR | LIST<INTEGER | FLOAT>) :: FLOAT"
"vector_dimension_count""Vector""vector_dimension_count(input :: VECTOR) :: INTEGER"
"vector_distance""Vector""vector_distance(vector1 :: VECTOR, vector2 :: VECTOR, coordinateType :: [EUCLIDEAN, EUCLIDEAN_SQUARED, MANHATTAN, COSINE, DOT, HAMMING]) :: FLOAT"
"vector_norm""Vector""vector_norm(vector :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, MANHATTAN]) :: FLOAT"

6 rows

Graph element functions

These functions read a node An 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 relationship A 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 path An 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 property A 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 id The 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.

SignatureReturnsNotes
elementId(input :: NODE | RELATIONSHIP) :: STRINGThe element id4:relate-neo4j:n<k> for a node, 5:relate-neo4j:r<k> for a relationship in the neo4j namespace
id(input :: NODE | RELATIONSHIP) :: INTEGERThe integer idDeprecated; the catalog names elementId as the replacement
db.nameFromElementId(elementId :: STRING) :: STRINGThe namespace of an element idneo4j for the data namespace
labels(input :: NODE) :: LIST<STRING>The node's labels—
type(input :: RELATIONSHIP) :: STRINGThe relationship type—
keys(input :: NODE | RELATIONSHIP | MAP) :: LIST<STRING>The property names, or a map's keysIn sorted order
properties(input :: NODE | RELATIONSHIP | MAP) :: MAPEvery property as a mapA map argument returns the map
startNode(input :: RELATIONSHIP) :: NODEThe start node—
endNode(input :: RELATIONSHIP) :: NODEThe end node—
nodes(input :: PATH) :: LIST<NODE>The path's nodes, in order—
relationships(input :: PATH) :: LIST<RELATIONSHIP>The path's relationships, in order—
length(input :: PATH) :: INTEGERThe number of relationships in the path—
path_length(input :: PATH) :: INTEGERThe number of relationships in the pathGQL name of length

The cells from here on run on the shared example graph:

Cypher
CREATE (ada:Person {name: 'Ada', role: 'engineer'}),
       (grace:Person {name: 'Grace', role: 'engineer'}),
       (noor:Person {name: 'Noor', role: 'maintainer'}),
       (relate:Project {name: 'relate', language: 'Rust'}),
       (tck:Project {name: 'opencypher-tck', language: 'Gherkin'}),
       (ada)-[:WORKS_ON {since: 2024}]->(relate),
       (grace)-[:WORKS_ON {since: 2023}]->(relate),
       (grace)-[:WORKS_ON {since: 2022}]->(tck),
       (noor)-[:MAINTAINS]->(relate),
       (ada)-[:KNOWS]->(grace)
Recorded result
(no rows) · nodes created: 5, relationships created: 5, properties set: 13, labels added: 5
Cypher
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
Recorded result
labelstypekeyspropsends_athopspath_nodesnamespace
["Person"]"WORKS_ON"["name", "role"]{since: 2024}"relate"12"neo4j"

1 row

Scalar functions

SignatureReturnsNotes
coalesce(input :: ANY ...) :: ANYThe first argument that is not nullAt least one argument
nullIf(v1 :: ANY, v2 :: ANY) :: ANYnull when the two are equal, else v1—
valueType(input :: ANY) :: STRINGThe type name with its nullabilityvalueType(1) is INTEGER NOT NULL (types)
size(input :: STRING | VECTOR | LIST<ANY>) :: INTEGERCharacters in a string, elements in a list, dimensions of a vector—
cardinality(input :: MAP | LIST<ANY> | PATH) :: INTEGERKeys in a map, elements in a list, nodes plus relationships in a pathA one-hop path gives 3
char_length(input :: STRING) :: INTEGERCharacters in a stringGQL name
character_length(input :: STRING) :: INTEGERCharacters in a stringGQL name
head(list :: LIST<ANY>) :: ANYThe first elementnull for an empty list
last(list :: LIST<ANY>) :: ANYThe last elementnull for an empty list
linenumber() :: INTEGERThe line LOAD CSV is readingListed by SHOW FUNCTIONS; a call fails with syntax error: UnknownFunction: unknown function linenumber(), inside LOAD CSV too
file() :: STRINGThe file LOAD CSV is readingListed 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
firstsametypecharskeysempty_head
"fallback"null"FLOAT NOT NULL"42null

1 row

Conversion functions

SignatureReturnsNotes
toString(input :: ANY) :: STRINGThe value as a stringMaps, 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
toStringOrNull(input :: ANY) :: STRINGAs toString, or null instead of an error—
toInteger(input :: BOOLEAN | STRING | INTEGER | FLOAT) :: INTEGERThe value as an integerA 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
toIntegerOrNull(input :: ANY) :: INTEGERAs toInteger, or null—
toFloat(input :: STRING | INTEGER | FLOAT) :: FLOATThe value as a float'NaN' and 'Infinity' parse; other spellings are null
toFloatOrNull(input :: ANY) :: FLOATAs toFloat, or null—
toBoolean(input :: BOOLEAN | STRING | INTEGER) :: BOOLEANThe value as a booleanStrings 'true' and 'false' in any case; other strings give null. An integer is false only for 0
toBooleanOrNull(input :: ANY) :: BOOLEANAs toBoolean, or null—
toStringList(input :: LIST<ANY>) :: LIST<STRING>Each element as a stringA null element becomes 'null'
toIntegerList(input :: VECTOR | LIST<ANY>) :: LIST<INTEGER>Each element as an integerAn element that does not convert becomes null; never fails for an element
toFloatList(input :: VECTOR | LIST<ANY>) :: LIST<FLOAT>Each element as a floatSame rule; also takes a vector
toBooleanList(input :: LIST<ANY>) :: LIST<BOOLEAN>Each element as a booleanSame rule
Cypher
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
Recorded result
displaytruncatedhexbad_intboolnot_boolintsfrom_vector
"{a: 1}"-331nulltruenull[1, null][1.0, 2.0]

1 row

String functions

SignatureReturnsNotes
toUpper(input :: STRING) :: STRINGUppercaseupper is the GQL name
upper(input :: STRING) :: STRINGUppercase—
toLower(input :: STRING) :: STRINGLowercaselower is the GQL name
lower(input :: STRING) :: STRINGLowercase—
trim(input :: STRING) :: STRINGLeading and trailing whitespace removed—
trim([[LEADING | TRAILING | BOTH] [trimCharacterString :: STRING] FROM] input :: STRING) :: STRINGThe given characters removed from one or both endstrim(LEADING 'x' FROM 'xxaxx') is 'axx'
ltrim(input :: STRING) :: STRINGLeading whitespace removed—
ltrim(input :: STRING, trimCharacterString :: STRING) :: STRINGLeading characters removed—
rtrim(input :: STRING) :: STRINGTrailing whitespace removed—
rtrim(input :: STRING, trimCharacterString :: STRING) :: STRINGTrailing characters removed—
btrim(input :: STRING) :: STRINGWhitespace removed from both ends—
btrim(input :: STRING, trimCharacterString :: STRING) :: STRINGCharacters removed from both ends—
normalize(input :: STRING) :: STRINGThe string in Unicode normal form NFC—
normalize(input :: STRING, normalForm = NFC :: [NFC, NFD, NFKC, NFKD]) :: STRINGThe string in the given formThe form is a bare keyword
replace(original :: STRING, search :: STRING, replace :: STRING) :: STRINGEvery occurrence replacedAn empty search inserts between every character
replace(original :: STRING, search :: STRING, replace :: STRING, limit :: INTEGER) :: STRINGAt most limit occurrences replaced, from the leftreplace('banana', 'a', 'o', 2) is 'bonona'
substring(original :: STRING, start :: INTEGER) :: STRINGThe rest from a zero-based startA start past the end gives ''
substring(original :: STRING, start :: INTEGER, length :: INTEGER) :: STRINGlength characters from startA float literal fails with InvalidArgumentType
left(original :: STRING, length :: INTEGER) :: STRINGThe first length charactersThe whole string when it is shorter
right(original :: STRING, length :: INTEGER) :: STRINGThe last length characters—
split(original :: STRING, splitDelimiters :: STRING | LIST<STRING>) :: LIST<STRING>The parts between delimitersA list splits on any of its delimiters; split('', ',') is ['']
reverse(input :: STRING | LIST<ANY>) :: STRING | LIST<ANY>The characters or elements in reverse order—
string.join(input :: LIST<STRING>, delimiter :: STRING) :: STRINGThe elements joined by the delimiternull elements are skipped
string.regexReplace(original :: STRING, regex :: STRING, replacement :: STRING) :: STRINGEvery regular expression match replaced—
string.indexOf(input :: STRING, value :: STRING) :: INTEGERThe 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
Recorded result
uppertrimmedlimitedsubpartsjoinedmaskedat
"RELATE""ada""bonona""cypher"["a", "b", "c"]"Ada & Grace""vN.N.N"2

1 row

List functions

SignatureReturnsNotes
tail(input :: LIST<ANY>) :: LIST<ANY>Every element but the first[] for an empty list
reverse(input :: STRING | LIST<ANY>) :: STRING | LIST<ANY>The elements in reverse order—
range(start :: INTEGER, end :: INTEGER) :: LIST<INTEGER>start to end, both includedrange(1, 0) is []
range(start :: INTEGER, end :: INTEGER, step :: INTEGER) :: LIST<INTEGER>Every step-th integerA negative step counts down; a zero step fails with NumberOutOfRange: range() step cannot be 0
reduce(accumulator :: VARIABLE = initial :: ANY, variable :: VARIABLE IN list :: LIST<ANY> | expression :: ANY) :: ANYThe list folded into one valueSyntax in expressions
coll.flatten(list :: LIST<ANY>) :: LIST<ANY>Nested lists flattened one levelcoll.flatten([1, [2, [3]]]) is [1, 2, [3]]
coll.flatten(list :: LIST<ANY>, depth :: INTEGER) :: LIST<ANY>Nested lists flattened depth levels—
coll.sort(list :: LIST<ANY>) :: LIST<ANY>The elements in ascending order—
coll.indexOf(list :: LIST<ANY>, value :: ANY) :: INTEGERThe zero-based index of the first match-1 when absent
coll.insert(list :: LIST<ANY>, index :: INTEGER, value :: ANY) :: LIST<ANY>The list with value at index—
coll.remove(list :: LIST<ANY>, index :: INTEGER) :: LIST<ANY>The list without the element at index—
coll.max(list :: LIST<ANY>) :: ANYThe largest element—
coll.min(list :: LIST<ANY>) :: ANYThe smallest element—
coll.distinct(list :: LIST<ANY>) :: LIST<ANY>The list without duplicates, first occurrences kept—

size, head and last are under scalar functions.

Cypher
RETURN tail([1, 2, 3]) AS tail, range(0, 10, 3) AS stepped, range(5, 1, -2) AS down,
       coll.flatten([1, [2, [3]]], 2) AS flat, coll.sort([3, 1, 2]) AS sorted,
       coll.insert([1, 3], 1, 2) AS inserted, coll.distinct([1, 1, 2]) AS distinct
Recorded result
tailsteppeddownflatsortedinserteddistinct
[2, 3][0, 3, 6, 9][5, 3, 1][1, 2, 3][1, 2, 3][1, 2, 3][1, 2]

1 row

Math functions

SignatureReturnsNotes
abs(input :: INTEGER | FLOAT) :: INTEGER | FLOATThe absolute value, of the input's type—
ceil(input :: FLOAT) :: FLOATThe smallest whole number not less than the inputceil(4.2) is 5.0
ceiling(input :: FLOAT) :: FLOATSame as ceilGQL name
floor(input :: FLOAT) :: FLOATThe largest whole number not greater than the input—
round(value :: FLOAT) :: FLOATThe nearest whole numberA half rounds up toward positive infinity: round(2.5) is 3.0, round(-2.5) is -2.0
round(value :: FLOAT, precision :: INTEGER | FLOAT) :: FLOATRounded to precision decimal places, half upround(3.14159, 2) is 3.14
round(value :: FLOAT, precision :: INTEGER | FLOAT, mode :: STRING) :: FLOATRounded with a modeModes: 'UP', 'DOWN', 'CEILING', 'FLOOR', 'HALF_UP', 'HALF_DOWN', 'HALF_EVEN'
sign(input :: INTEGER | FLOAT) :: INTEGER-1, 0 or 1—
rand() :: FLOATA random float from 0 included to 1 excludedA new value per call
isNaN(input :: INTEGER | FLOAT) :: BOOLEANWhether the value is NaN—
sqrt(input :: FLOAT) :: FLOATThe square rootsqrt(-1) is NaN
exp(input :: FLOAT) :: FLOATe raised to the input—
log(input :: FLOAT) :: FLOATThe natural logarithmlog(0) is -Infinity
ln(input :: FLOAT) :: FLOATThe natural logarithmGQL name
log10(input :: FLOAT) :: FLOATThe base-10 logarithm—
e() :: FLOATEuler's number—
pi() :: FLOATπ—
sin, cos, tan, cot (input :: FLOAT) :: FLOATSine, cosine, tangent, cotangent of radians—
asin, acos, atan (input :: FLOAT) :: FLOATThe inverse functions, in radians—
atan2(y :: FLOAT, x :: FLOAT) :: FLOATThe angle of the point (x, y), in radians—
sinh, cosh, tanh, coth (input :: FLOAT) :: FLOATThe hyperbolic functionsasinh, acosh and atanh are not functions in relate
haversin(input :: FLOAT) :: FLOATHalf the versine—
degrees(input :: FLOAT) :: FLOATRadians to degrees—
radians(input :: FLOAT) :: FLOATDegrees 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
Recorded result
absceilhalf_uphalf_evensignrootlog10degreesrand_in_range
55.0-2.02.0-14.03.0180.0true

1 row

Temporal functions

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.

SignatureReturnsNotes
date(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, pattern = DEFAULT_TEMPORAL_ARGUMENT :: STRING) :: DATEA DATEdate('2026-11-08'), date('2026-W45-7'), date({year: 2026, month: 11, day: 8}), date('2026-11-08', 'yyyy-MM-dd')
localtime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, pattern = DEFAULT_TEMPORAL_ARGUMENT :: STRING) :: LOCAL TIMEA LOCAL TIME—
time(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, pattern = DEFAULT_TEMPORAL_ARGUMENT :: STRING) :: ZONED TIMEA ZONED TIME—
localdatetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, pattern = DEFAULT_TEMPORAL_ARGUMENT :: STRING) :: LOCAL DATETIMEA LOCAL DATETIME—
datetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, pattern = DEFAULT_TEMPORAL_ARGUMENT :: STRING) :: ZONED DATETIMEA ZONED DATETIMEA named zone in brackets ([Europe/Paris]) or timezone: in a map is kept
local_time(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY[, pattern :: STRING]) :: LOCAL TIMEA LOCAL TIMEGQL name of localtime
zoned_time(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY[, pattern :: STRING]) :: ZONED TIMEA ZONED TIMEGQL name of time
local_datetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY[, pattern :: STRING]) :: LOCAL DATETIMEA LOCAL DATETIMEGQL name of localdatetime
zoned_datetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY[, pattern :: STRING]) :: ZONED DATETIMEA ZONED DATETIMEGQL name of datetime
date.realtime, date.statement, date.transaction (timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATEThe current date on the real-time, statement, or transaction clock—
time.realtime, time.statement, time.transaction (timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIMEThe current time on that clock—
localtime.realtime, localtime.statement, localtime.transaction (timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIMEThe current local time on that clock—
datetime.realtime, datetime.statement, datetime.transaction (timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIMEThe current instant on that clockdatetime.statement() = datetime.transaction() in a single statement
localdatetime.realtime, localdatetime.statement, localdatetime.transaction (timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIMEThe current local date and time on that clock—
date.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: DATEThe input truncated to unitdate.truncate('month', date('2026-11-08')) is 2026-11-01. datetime.truncate, localdatetime.truncate, time.truncate and localtime.truncate work the same way
datetime.fromepoch(seconds :: INTEGER | FLOAT, nanoseconds :: INTEGER | FLOAT) :: ZONED DATETIMEThe instant that many seconds after 1970-01-01 UTC—
datetime.fromepochmillis(milliseconds :: INTEGER | FLOAT) :: ZONED DATETIMEThe instant that many milliseconds after 1970-01-01 UTC—
timestamp() :: INTEGERMilliseconds since 1970-01-01 UTCOne value for the whole statement
duration(input :: ANY, pattern = DEFAULT_TEMPORAL_ARGUMENT :: STRING) :: DURATIONA DURATION from an ISO 8601 string or a mapMap keys: years, months, weeks, days, hours, minutes, seconds and smaller units; duration({weeks: 2}) is P14D
duration.between(from :: ANY, to :: ANY) :: DURATIONThe difference in months, days, and secondsNegative when to is earlier: PT-1H-30M
duration.inMonths(from :: ANY, to :: ANY) :: DURATIONThe difference in whole months—
duration.inDays(from :: ANY, to :: ANY) :: DURATIONThe difference in whole days—
duration.inSeconds(from :: ANY, to :: ANY) :: DURATIONThe difference in seconds—
duration_between(from :: ANY, to :: ANY) :: DURATIONSame as duration.betweenGQL name
format(value :: DATE | LOCAL TIME | ZONED TIME | LOCAL DATETIME | ZONED DATETIME | DURATION) :: STRINGThe ISO 8601 form—
format(value :: …, pattern :: STRING) :: STRINGThe value formatted with a patternformat(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
Recorded result
from_weekmonth_startdaysepochformattednow_works
"2026-11-08""2026-11-01""P311D""1970-01-01T00:00:01Z""08/11/2026"true

1 row

Spatial functions

SignatureReturnsNotes
point(input :: MAP) :: POINTA 2D or 3D pointThe keys choose the coordinate system (points)
point.distance(from :: POINT, to :: POINT) :: FLOATThe distance between two points in one coordinate systemEuclidean for Cartesian points; meters for WGS-84 points, on a sphere of radius 6,378,140 m. Points in two different systems give null
point.withinBBox(point :: POINT, lowerLeft :: POINT, upperRight :: POINT) :: BOOLEANWhether the point is inside the boxA POINT INDEX serves this filter and point.distance(…) < <bound> (geospatial)
Cypher
RETURN point.distance(point({x: 0, y: 0}), point({x: 3, y: 4})) AS cartesian,
       round(point.distance(point({latitude: 51.5, longitude: -0.1}), point({latitude: 48.86, longitude: 2.35}))) AS meters,
       point.withinBBox(point({x: 1, y: 1}), point({x: 0, y: 0}), point({x: 2, y: 2})) AS inside
Recorded result
cartesianmetersinside
5.0341818.0true

1 row

Vector functions

SignatureReturnsNotes
vector(vectorValue :: STRING | LIST<INTEGER | FLOAT>, dimension :: INTEGER, coordinateType :: [INTEGER64, INTEGER32, INTEGER16, INTEGER8, FLOAT64, FLOAT32]) :: VECTORA VECTOR valueThe coordinate type is a bare keyword; the spellings are in vectors
vector.similarity.cosine(a :: VECTOR | LIST<INTEGER | FLOAT>, b :: VECTOR | LIST<INTEGER | FLOAT>) :: FLOATCosine similarity rescaled to 0 to 11.0 same direction, 0.5 orthogonal, 0.0 opposite; the score a cosine vector index reports
vector.similarity.euclidean(a :: VECTOR | LIST<INTEGER | FLOAT>, b :: VECTOR | LIST<INTEGER | FLOAT>) :: FLOAT1 / (1 + d²), where d is the Euclidean distance1.0 for identical vectors
vector_distance(vector1 :: VECTOR, vector2 :: VECTOR, coordinateType :: [EUCLIDEAN, EUCLIDEAN_SQUARED, MANHATTAN, COSINE, DOT, HAMMING]) :: FLOATThe raw distance under the metricLower is closer for every metric; DOT is the negated dot product. Takes VECTOR values only
vector_norm(vector :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, MANHATTAN]) :: FLOATThe distance from the origin—
vector_dimension_count(input :: VECTOR) :: INTEGERThe dimensions—

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 v
RETURN 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
Recorded result
cosineeuclideandistancemanhattannormdims
0.50.038461539894342425.07.05.02

1 row

UUID functions

SignatureReturnsNotes
uuid() :: UUIDA random UUIDOn the WASM build, the call stops the engine with time not implemented on this platform
uuid(name :: STRING) :: UUIDThe UUID a 36-character string spells—
uuid(mostSigBits :: INTEGER, leastSigBits :: INTEGER) :: UUIDThe UUID with these two 64-bit halvesuuid(0, 1) is 00000000-0000-0000-0000-000000000001
uuid.mostSignificantBits(uuid :: UUID) :: INTEGERThe high 64 bits, signed—
uuid.leastSignificantBits(uuid :: UUID) :: INTEGERThe low 64 bits, signed—
randomUUID() :: STRINGA random UUID as a STRINGSame WASM limit as uuid()
Cypher
WITH uuid('f066ecfc-5151-4121-8a36-b35e00d72918') AS u
RETURN toString(u) AS text, uuid.mostSignificantBits(u) AS high, uuid(0, 1) AS from_halves
Recorded result
texthighfrom_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.

SignatureReturnsNotes
count(input :: ANY) :: INTEGERThe number of values that are not nullcount(*) counts rows, null included
sum(input :: INTEGER | FLOAT | DURATION) :: INTEGER | FLOAT | DURATIONThe sum0 over no values; mixing numbers and durations fails
avg(input :: INTEGER | FLOAT | DURATION) :: INTEGER | FLOAT | DURATIONThe meanA float for integers; null over no values
min(input :: ANY) :: ANYThe smallest valueAcross types, the type order of ORDER BY applies
max(input :: ANY) :: ANYThe largest valueSame rule
collect(input :: ANY) :: LIST<ANY>The values as a listnull values are left out; [] over no values
stDev(input :: FLOAT) :: FLOATSample standard deviation, divided by N − 1null over no values
stDevP(input :: FLOAT) :: FLOATPopulation standard deviation, divided by N—
percentileCont(input :: FLOAT, percentile :: FLOAT) :: FLOATThe percentile, interpolatedpercentile from 0 to 1
percentileDisc(input :: INTEGER | FLOAT, percentile :: FLOAT) :: INTEGER | FLOATThe nearest value at the percentileReturns a FLOAT for integer input: 2.0
collect_list(input :: ANY) :: LIST<ANY>Same as collectGQL name
stdev_samp(input :: FLOAT) :: FLOATSame as stDevGQL name
stdev_pop(input :: FLOAT) :: FLOATSame as stDevPGQL name
percentile_cont(input :: FLOAT, percentile :: FLOAT) :: FLOATSame as percentileContGQL name
percentile_disc(input :: INTEGER | FLOAT, percentile :: FLOAT) :: INTEGER | FLOATSame as percentileDiscGQL name

Every aggregate but count(*) skips null values.

Cypher
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 median
ORDER BY project
Recorded result
projectpeoplenamesfirstmeanmedian
"opencypher-tck"1["Grace"]20222022.02022.0
"relate"2["Grace", "Ada"]20232023.52023.0

2 rows

Predicate functions

SignatureReturnsNotes
all(variable :: VARIABLE IN list :: LIST<ANY> WHERE predicate :: ANY) :: BOOLEANtrue when every element passestrue for an empty list
any(variable :: VARIABLE IN list :: LIST<ANY> WHERE predicate :: ANY) :: BOOLEANtrue when an element passesfalse for an empty list
none(variable :: VARIABLE IN list :: LIST<ANY> WHERE predicate :: ANY) :: BOOLEANtrue when no element passes—
single(variable :: VARIABLE IN list :: LIST<ANY> WHERE predicate :: ANY) :: BOOLEANtrue when exactly one element passes—
allReduce(accumulator :: VARIABLE = initial :: ANY, variable :: VARIABLE IN list :: LIST<ANY> | reducer :: ANY, predicate :: BOOLEAN) :: BOOLEANtrue when the predicate holds after every stepStops at the first step that fails
exists(input :: ANY) :: BOOLEANtrue when the pattern has a matchTakes 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
isEmpty(input :: STRING | MAP | LIST<ANY>) :: BOOLEANtrue for '', {} and []—
property_exists(element :: NODE | RELATIONSHIP, propertyKeyName :: STRING) :: BOOLEANtrue when the property is setThe 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
Recorded result
workshas_rolehas_emailemptyall_recent
truetruefalsetruetrue

1 row

Path functions

SignatureReturnsNotes
shortestPath(pathPattern :: PATH) :: PATHOne shortest path for the patternIn an expression, null when there is none
allShortestPaths(pathPattern :: PATH) :: LIST<PATH>Every shortest path—

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
hopspaths
21

1 row

Graph reference functions

SignatureReturnsNotes
graph.names() :: LIST<STRING>The graphs of a composite databaseFails 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()
graph.byName(name :: STRING) :: GRAPHA graph reference for USEComposite databases only; same error
graph.byElementId(elementId :: STRING) :: GRAPHA graph reference for USEComposite databases only; same error
graph.propertiesByName(graphName :: STRING) :: MAPA graph's propertiesComposite databases only; same error

Preview functions

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.

SignatureReturnsOpt-inNotes
coll.zip(list1 :: LIST<ANY>, list2 :: LIST<ANY> ...) :: LIST<ANY>Per-index lists, to the longest input's lengthcoll-zipMissing positions are null: coll.zip([1, 2], ['a']) is [[1, 'a'], [2, null]]
coll.hasAnyOf(list :: LIST<ANY>, values :: LIST<ANY>) :: BOOLEANtrue when any of values is in listcoll-hasAn undecided result with a null element is null
coll.hasAllOf(list :: LIST<ANY>, values :: LIST<ANY>) :: BOOLEANtrue when every one of values is in listcoll-has—
coll.hasNoneOf(list :: LIST<ANY>, values :: LIST<ANY>) :: BOOLEANtrue when none of values is in listcoll-has—
stddev_samp(input :: FLOAT) :: FLOATSame as stDevgql-stddev-aliasesstdev_samp needs no opt-in
stddev_pop(input :: FLOAT) :: FLOATSame as stDevPgql-stddev-aliasesstdev_pop needs no opt-in

With the opt-ins in the command's environment:

RELATE_PREVIEW=coll-zip,coll-has,gql-stddev-aliases relate --mode jsonl "RETURN coll.zip([1, 2], ['a']) AS zipped, coll.hasAnyOf([1, 2], [2]) AS any_of, coll.hasAllOf([1, 2], [1, 3]) AS all_of, coll.hasNoneOf([1, 2], [5]) AS none_of"
{"all_of":false,"any_of":true,"none_of":true,"zipped":[[1,"a"],[2,null]]}
{"planCache":"miss","timings":{"elapsed_ms":0.424875,"execute_ms":0.25816700000000004,"lex_parse_ms":0.031375,"lower_ms":0.03875,"parse_ms":0.11012499999999999,"plan_ms":0.048291999999999995,"result_generation_ms":0.0005,"rewrite_ms":0.007416}}

See also

  • Expressions: operators, CASE, comprehensions and the forms that look like functions (reduce, all, COUNT { … }).
  • Types and values: the values these functions take and return.
  • Procedures: the CALL procedures, db.* and the ontology preview.
  • Search: the SEARCH clause the vector functions' scores come from.
  • Geospatial memory: points, distances and boxes in an agent's memory.