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.
83 built-in functions across 9 categories: Aggregation (11), String (23), Math (17), Type Conversion (5), Graph Introspection (6), Node Metadata (5), Map and List (4), Date/Time (4), Utility (4), 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 Since countcount(expr)Number of non-null values Integer 0.4.0 count(DISTINCT)count(DISTINCT expr)Number of distinct non-null values Integer 0.4.0 sumsum(expr)Sum of numeric values Float 0.4.0 avgavg(expr)Arithmetic mean Float 0.4.0 minmin(expr)Minimum value Same as input 0.4.0 maxmax(expr)Maximum value Same as input 0.4.0 collectcollect(expr)Collect values into a list List 0.4.0 percentilepercentile(expr, p)Percentile value (p between 0.0 and 1.0) Float 4.0.0 stdevstdev(expr)Sample standard deviation Float 4.0.0 variancevariance(expr)Sample variance Float 4.0.0 medianmedian(expr)Median (50th percentile) Float 4.0.0
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 Since toLowertoLower(s)Convert to lowercase String 0.17.0 toUppertoUpper(s)Convert to uppercase String 0.17.0 trimtrim(s)Strip leading and trailing whitespace String 0.17.0 ltrimltrim(s)Strip leading whitespace String 4.0.0 rtrimrtrim(s)Strip trailing whitespace String 4.0.0 substringsubstring(s, start, len)Extract substring from start position String 0.17.0 leftleft(s, n)First n characters String 0.17.0 rightright(s, n)Last n characters String 0.17.0 headhead(expr)First element of a list or comma-separated string Same as element 3.0.0 lastlast(expr)Last element of a list or comma-separated string Same as element 3.0.0 replacereplace(s, find, rep)Replace all occurrences of find with rep String 0.17.0 splitsplit(s, delim)Split string by delimiter into list List 0.17.0 reversereverse(s)Reverse a string or comma-separated list String 0.17.0 sortsort(expr)Alphabetically sort comma-separated string values String 4.0.0 repeatrepeat(s, n)Repeat string n times String 4.0.0 lpadlpad(s, width, char)Left-pad string to width with char String 4.0.0 rpadrpad(s, width, char)Right-pad string to width with char String 4.0.0 containscontains(s, sub)True if string contains substring Boolean 4.0.0 startsWithstartsWith(s, prefix)True if string starts with prefix Boolean 4.0.0 endsWithendsWith(s, suffix)True if string ends with suffix Boolean 4.0.0 indexOfindexOf(s, sub)Position of substring, -1 if not found Integer 4.0.0 sizesize(s)Length of string or list Integer 0.10.0 toStringtoString(expr)Convert any value to string representation String 0.10.0
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 Since absabs(expr)Absolute value Float 4.0.0 roundround(expr)Round to nearest integer Float 4.0.0 ceilceil(expr)Ceiling (round up) Float 4.0.0 floorfloor(expr)Floor (round down) Float 4.0.0 sqrtsqrt(expr)Square root Float 4.0.0 signsign(expr)Signum: -1, 0, or 1 Float 4.0.0 expexp(expr)e raised to the power of the value Float 4.0.0 loglog(expr)Natural logarithm (ln) Float 4.0.0 log10log10(expr)Base-10 logarithm Float 10.0.0 log2log2(expr)Base-2 logarithm Float 10.0.0 powerpower(base, exp)Raise base to exponent Float 4.0.0 sinsin(expr)Sine (radians) Float 4.0.0 coscos(expr)Cosine (radians) Float 4.0.0 tantan(expr)Tangent (radians) Float 4.0.0 atan2atan2(y, x)Arctangent of y/x (radians) Float 4.0.0 pipi()Pi constant (3.14159...) Float 4.0.0 ee()Euler's number (2.71828...) Float 4.0.0
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 Since toStringtoString(expr)Convert to string String 0.10.0 toIntegertoInteger(expr)Convert to integer Integer 0.10.0 toFloattoFloat(expr)Convert to float Float 0.10.0 toBooleantoBoolean(expr)Convert to boolean Boolean 4.0.0 coalescecoalesce(a, b, ...)First non-null value Same as first non-null 0.10.0
MATCH (n:Person)
RETURN toInteger(n.ageStr) AS age, coalesce (n.nickname, n.name) AS displayName
Function Syntax Description Return Type Since idid(n)Internal node or relationship ID Integer 0.8.0 labelslabels(n)List of labels on a node List<String> 0.8.0 typetype(r)Relationship type string String 0.8.0 degreedegree(n)Total degree (in + out) Integer 3.0.0 inDegreeinDegree(n)Incoming relationship count Integer 3.0.0 outDegreeoutDegree(n)Outgoing relationship count Integer 3.0.0
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 Since confidenceconfidence(n)World-model confidence score (0.0-1.0) Float 4.0.0 observationClassobservationClass(n)Observation class: observed, inferred, or predicted String 4.0.0 authorityPlaneauthorityPlane(n)Authority plane: semantic or scene String 4.0.0 clockDomainclockDomain(n)Temporal clock domain name String 4.0.0 observationSourceobservationSource(n)Source identity (sensor, model, user) String 4.0.0
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 Since propertiesproperties(n)Full property map as string String 4.0.0 keyskeys(n)List of property key names List<String> 3.0.0 rangerange(start, end)Generate integer sequence [start..=end] List<Integer> 4.0.0 mapProjectionn {.name, .age}Return only named properties as a map Map 4.0.0
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
All date/time functions are non-deterministic (they return the current time).
Function Syntax Description Return Type Since timestamptimestamp()Current Unix timestamp in milliseconds Integer 4.0.0 datedate()Current date as ISO string (YYYY-MM-DD) String 4.0.0 timetime()Current time as ISO string (HH:MM:SS.mmm) String 4.0.0 datetimedatetime()Current datetime as ISO string (YYYY-MM-DDTHH:MM:SS.mmm) String 4.0.0
CREATE (e:Event { name : 'deploy' , createdAt : timestamp () , date : date() } )
RETURN e
Function Syntax Description Return Type Since randomUUIDrandomUUID()Generate a UUID v4 string String 4.0.0 hashhash(expr)Deterministic FNV-1a 64-bit hash as hex string String 4.0.0 toJsontoJson(n)Serialize all node properties to JSON string String 4.0.0 sizesize(expr)Length of string or list Integer 0.10.0
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 Since existsexists(n.prop)True if property exists Boolean 0.6.0 IS NULLn.prop IS NULLTrue if property is null or missing Boolean 0.15.0 IS NOT NULLn.prop IS NOT NULLTrue if property exists and is not null Boolean 0.15.0 INexpr IN [list]True if value is in the list Boolean 0.20.0
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 Data Types Next → Aggregations