Try examples Copy for AI agent
This reference is designed for both human developers and AI coding agents. Every entry includes complete syntax that can be used directly in queries.
93 built-in functions across 10 categories: Aggregation (14), String (24), Math (17), Type Conversion (5), Graph Introspection (6), Node Metadata (5), Map and List (5), Date/Time (7), Temporal (1), Utility (5), and Predicates (4).
Aggregation functions operate across rows in a result set. Use with or without GROUP BY (via WITH).
Function Syntax Description Return Type countcount(expr)Number of non-null values Integer count(DISTINCT)count(DISTINCT expr)Number of distinct non-null values Integer sumsum(expr)Sum of numeric values Float avgavg(expr)Arithmetic mean Float minmin(expr)Minimum value Same as input maxmax(expr)Maximum value Same as input collectcollect(expr)Collect values into a list List percentilepercentile(expr, p)Percentile value (p between 0.0 and 1.0) Float stdevstdev(expr)Sample standard deviation Float variancevariance(expr)Sample variance Float medianmedian(expr)Median (50th percentile) Float covar_popcovar_pop(a.x, b.y)Population covariance between two property columns Float covar_sampcovar_samp(a.x, b.y)Sample covariance between two property columns Float corrcorr(a.x, b.y)Pearson correlation coefficient between two property columns Float
MATCH (n:Person)
RETURN count (n) AS total, avg (n.age) AS avgAge, percentile(n.score, 0.95 ) AS p95
MATCH (n:Person)
WITH n.department AS dept, collect (n.name) AS members, stdev (n.salary) AS salaryStdev
RETURN dept, members, salaryStdev
Function Syntax Description Return Type toLowertoLower(s)Convert to lowercase String toUppertoUpper(s)Convert to uppercase String trimtrim(s)Strip leading and trailing whitespace String ltrimltrim(s)Strip leading whitespace String rtrimrtrim(s)Strip trailing whitespace String substringsubstring(s, start, len)Extract substring from start position String leftleft(s, n)First n characters String rightright(s, n)Last n characters String headhead(expr)First element of a list or comma-separated string Same as element tailtail(expr)All elements except the first, from a list or comma-separated string Same as input lastlast(expr)Last element of a list or comma-separated string Same as element replacereplace(s, find, rep)Replace all occurrences of find with rep String splitsplit(s, delim)Split string by delimiter into list List reversereverse(s)Reverse a string or comma-separated list String sortsort(expr)Alphabetically sort comma-separated string values String repeatrepeat(s, n)Repeat string n times String lpadlpad(s, width, char)Left-pad string to width with char String rpadrpad(s, width, char)Right-pad string to width with char String containscontains(s, sub)True if string contains substring Boolean startsWithstartsWith(s, prefix)True if string starts with prefix Boolean endsWithendsWith(s, suffix)True if string ends with suffix Boolean indexOfindexOf(s, sub)Position of substring, -1 if not found Integer sizesize(s)Length of string or list Integer toStringtoString(expr)Convert any value to string representation String
MATCH (n:Person)
RETURN toLower(n.name) AS lower, left (n.name, 3 ) AS initials, size(n.name) AS len
MATCH (n:Person)
WHERE startsWith(n.email, 'admin' )
RETURN n.name, replace (n.email, '@old.com' , '@new.com' ) AS newEmail
MATCH (n:Person)
RETURN lpad(toString(n.id), 6 , '0' ) AS paddedId, repeat( '*' , n.rating) AS stars
Function Syntax Description Return Type absabs(expr)Absolute value Float roundround(expr)Round to nearest integer Float ceilceil(expr)Ceiling (round up) Float floorfloor(expr)Floor (round down) Float sqrtsqrt(expr)Square root Float signsign(expr)Signum: -1, 0, or 1 Float expexp(expr)e raised to the power of the value Float loglog(expr)Natural logarithm (ln) Float log10log10(expr)Base-10 logarithm Float log2log2(expr)Base-2 logarithm Float powerpower(base, exp)Raise base to exponent Float sinsin(expr)Sine (radians) Float coscos(expr)Cosine (radians) Float tantan(expr)Tangent (radians) Float atan2atan2(y, x)Arctangent of y/x (radians) Float pipi()Pi constant (3.14159...) Float ee()Euler's number (2.71828...) Float
MATCH (n:Sensor)
RETURN n.name, abs (n.reading) AS magnitude, round (n.value * 100 ) / 100 AS rounded
MATCH (n:Point)
RETURN atan2 (n.y, n.x) AS angle, sqrt (power(n.x, 2 ) + power(n.y, 2 )) AS distance
Function Syntax Description Return Type toStringtoString(expr)Convert to string String toIntegertoInteger(expr)Convert to integer Integer toFloattoFloat(expr)Convert to float Float toBooleantoBoolean(expr)Convert to boolean Boolean coalescecoalesce(a, b, ...)First non-null value Same as first non-null
MATCH (n:Person)
RETURN toInteger(n.ageStr) AS age, coalesce (n.nickname, n.name) AS displayName
Function Syntax Description Return Type idid(n)Internal node or relationship ID Integer labelslabels(n)List of labels on a node List<String> typetype(r)Relationship type string String degreedegree(n)Total degree (in + out) Integer inDegreeinDegree(n)Incoming relationship count Integer outDegreeoutDegree(n)Outgoing relationship count Integer
MATCH (n:Person)
RETURN n.name, degree(n) AS connections, inDegree(n) AS followers, outDegree(n) AS following
ORDER BY degree(n) DESC
ArcFlow world-model metadata functions for provenance and trust scoring.
Function Syntax Description Return Type confidenceconfidence(n)World-model confidence score (0.0-1.0) Float observationClassobservationClass(n)Observation class: observed, inferred, or predicted String authorityPlaneauthorityPlane(n)Authority plane: semantic or scene String clockDomainclockDomain(n)Temporal clock domain name String observationSourceobservationSource(n)Source identity (sensor, model, user) String
MATCH (n:Observation)
WHERE confidence(n) > 0.8 AND observationClass(n) = 'observed'
RETURN n.name, confidence(n) AS conf, authorityPlane(n) AS plane
Function Syntax Description Return Type propertiesproperties(n)Full property map as string String keyskeys(n)List of property key names List<String> rangerange(start, end)Generate integer sequence [start..=end] List<Integer> mapProjectionn {.name, .age}Return only named properties as a map Map cardinalitycardinality(expr)Length of a list or string. Synonym of size — interchangeable in queries. Integer
MATCH (n:Person)
RETURN keys(n) AS propKeys, properties(n) AS allProps
MATCH (n:Person)
RETURN n { .name , .age } AS profile
UNWIND range ( 1 , 10 ) AS i
RETURN i
The zero-argument forms are non-deterministic (they return the current time). The string-argument forms parse an ISO 8601 input.
Function Syntax Description Return Type timestamptimestamp()Current Unix timestamp in milliseconds Integer datedate() / date("YYYY-MM-DD")Current date, or parse ISO date string String timetime() / time("HH:MM:SS")Current zoned time, or parse ISO time string String datetimedatetime() / datetime("YYYY-MM-DDTHH:MM:SSZ")Current zoned datetime, or parse ISO datetime string String localTimelocalTime() / localTime("HH:MM:SS")Current local time (no timezone), or parse ISO local time string String localDateTimelocalDateTime() / localDateTime("YYYY-MM-DDTHH:MM:SS")Current local datetime (no timezone), or parse ISO local datetime string String durationduration("PT1H30M")Parse an ISO 8601 duration string Duration
CREATE (e:Event { name : 'deploy' , createdAt : timestamp () , date : date() } )
RETURN e
Read the engine's logical clock from inside a query.
Function Syntax Description Return Type walSeqwalSeq()Current mutation sequence (advances on every CREATE/SET/MERGE/DELETE) Integer
-- Snapshot the current seq alongside the data being read
MATCH (e:Event)
RETURN e.id, e.kind, walSeq() AS observed_at_seq
-- Pair walSeq() with AS OF seq to anchor a follow - up query at the same logical point
WITH walSeq() AS now_seq
MATCH (a:Account { id : $id } ) AS OF seq now_seq
RETURN a.balance
The integer returned is the same sequence space used by AS OF seq N — pass it back through a parameter to query historical state, write it onto an audit record, or compare against g.seq to compute relative offsets.
The function name is case-insensitive: walSeq(), wal_seq(), WAL_SEQ(), and walseq() are all accepted by the parser. Pick whichever fits your team's naming convention — the canonical form in this reference is walSeq() to match the rest of the function table.
Function Syntax Description Return Type randomUUIDrandomUUID()Generate a UUID v4 string String hashhash(expr)Deterministic FNV-1a 64-bit hash as hex string String toJsontoJson(n)Serialize all node properties to JSON string String sizesize(expr)Length of string or list Integer sessionUsersessionUser()Identifier of the current session actor (GQL GS09) String
CREATE (n:Record { id : randomUUID() , fingerprint : hash(n.data) } )
RETURN n
MATCH (n:Person)
RETURN toJson(n) AS json
Predicate expressions used in WHERE clauses and RETURN.
Predicate Syntax Description Return Type existsexists(n.prop)True if property exists Boolean IS NULLn.prop IS NULLTrue if property is null or missing Boolean IS NOT NULLn.prop IS NOT NULLTrue if property exists and is not null Boolean INexpr IN [list]True if value is in the list Boolean
MATCH (n:Person)
WHERE exists(n.email) AND n.role IN [ 'admin' , 'editor' ]
RETURN n.name
MATCH (n:Person)
WHERE n.deletedAt IS NULL
RETURN n.name
Functions for operating on path values bound with MATCH p = ....
Function Syntax Description Return Type nodesnodes(path)Ordered list of nodes along the path List<Node> relationshipsrelationships(path)Ordered list of relationships along the path List<Rel> lengthlength(path)Number of relationships in the path Integer
MATCH p = (a:Person { name : 'Alice' } ) - [ * ..5 ] -> (b:Person { name : 'Dave' } )
RETURN length (p) AS hops, [n IN nodes (p) | n.name] AS names
-- Access by index ( 0 - based)
RETURN n.tags[ 0 ] -- first element
RETURN n.tags[$idx] -- dynamic index via parameter
-- Slice
RETURN n.tags[ 1 .. 3 ] -- elements at index 1 and 2
RETURN n.tags[.. 3 ] -- first 3 elements
RETURN n.tags[ - 2 ..] -- last 2 elements
-- [variable IN list WHERE filter | transform]
MATCH (n:Person)
RETURN [x IN n.scores WHERE x > 80 | x * 1.1 ] AS bonus_scores
-- filter only
RETURN [x IN n.tags WHERE x <> 'archived' ] AS active_tags
-- transform only
RETURN [x IN range ( 1 , 10 ) | x * x] AS squares
WHERE ALL (x IN n.scores WHERE x > 60 ) -- all elements match
WHERE ANY (x IN n.tags WHERE x = 'urgent' ) -- at least one matches
WHERE NONE (x IN n.tags WHERE x = 'spam' ) -- none match
← Previous Constraints Next → Aggregations