Skip to content

Cypher : some functions from Neo4J are missing #3355

@ExtReMLapin

Description

@ExtReMLapin

Hello,

Yesterday during my test, I skipped some stuff that would require the implementation of some functions.

I did NOT keep a track of the missing ones, but we can still have a list there https://neo4j.com/docs/cypher-manual/current/functions/

IMHO, priority number 1 should be adding elementId()

I have no idea how to add subtasks on github, like gitlab, so i'll shove the whole list there.

We do NOT personally need those function, I'm just giving a hand at tracking what's missing

I'm taking the bet that any agent with enough documentation from the neo4j wiki could do it easily


Aggregating functions


These functions take multiple values as arguments, and calculate and return an aggregated value from them.

  • avg() -- avg(input :: INTEGER | FLOAT | DURATION) :: INTEGER | FLOAT | DURATION -- Returns the average of a set of INTEGER, FLOAT, or DURATION values.

  • collect() -- collect(input :: ANY) :: LIST<ANY> -- Returns a list containing the values returned by an expression.

  • count() -- count(input :: ANY) :: INTEGER -- Returns the number of values or rows.

  • max() -- max(input :: ANY) :: ANY -- Returns the maximum value in a set of values.

  • min() -- min(input :: ANY) :: ANY -- Returns the minimum value in a set of values.

  • percentileCont() -- percentileCont(input :: FLOAT, percentile :: FLOAT) :: FLOAT -- Returns the percentile of a value over a group using linear interpolation.

  • percentileDisc() -- percentileDisc(input :: INTEGER | FLOAT, percentile :: FLOAT) :: FLOAT -- Returns the nearest INTEGER or FLOAT value to the given percentile over a group using a rounding method.

  • stDev() -- stDev(input :: FLOAT) :: FLOAT -- Returns the standard deviation for the given value over a group for a sample of a population.

  • stDevP() -- stDevP(input :: FLOAT) :: FLOAT -- Returns the standard deviation for the given value over a group for an entire population.

  • sum() -- sum(input :: INTEGER | FLOAT | DURATION) :: INTEGER | FLOAT | DURATION -- Returns the sum of a set of INTEGER, FLOAT, or DURATION values.

Database functions


Database functions provide information about databases.

  • db.nameFromElementId() -- db.nameFromElementId(elementId :: STRING) :: STRING -- Resolves the database name from the given element id.

Graph functions


Graph functions provide information about the constituent graphs in composite databases.

  • graph.byElementId() -- USE graph.byElementId(elementId :: STRING) -- Resolves the constituent graph to which a given element id belongs.

  • graph.byName() -- USE graph.byName(name :: STRING) -- Resolves a constituent graph by name.

  • graph.names() -- graph.names() :: LIST<STRING> -- Returns a list containing the names of all graphs in the current composite database.

  • graph.propertiesByName() -- graph.propertiesByName(name :: STRING) :: MAP -- Returns a map containing the properties associated with the given graph.

List functions


These functions return lists of other values. Further details and examples of lists may be found in Lists.

  • coll.distinct() -- coll.distinct(list :: LIST<ANY>) :: LIST<ANY> -- Returns the given list with all duplicate values removed.

  • coll.flatten() -- coll.flatten(list :: LIST<ANY>, depth = 1 :: INTEGER) :: LIST<ANY> -- Returns a list flattened to the given depth.

  • coll.indexOf() -- coll.indexOf(list :: LIST<ANY>, value :: ANY) :: INTEGER -- Returns the index of the first match of value in the given list, if the value is no present, -1 is returned.

  • coll.insert() -- coll.insert(list :: LIST<ANY>, index :: INTEGER, value :: ANY) :: LIST<ANY> -- Returns a list with the given value inserted at the given index.

  • coll.max() -- coll.max(list :: LIST<ANY>) :: ANY -- Returns the largest value.

  • coll.min() -- coll.min(list :: LIST<ANY>) :: ANY -- Returns the smallest value.

  • coll.remove() -- coll.remove(list :: LIST<ANY>, index :: INTEGER) :: LIST<ANY> -- Returns a list with the value at the given index removed.

  • coll.sort() -- coll.sort(list :: LIST<ANY>) :: LIST<ANY> -- Returns a sorted list.

  • keys() -- keys(input :: NODE | RELATIONSHIP | MAP) :: LIST<STRING> -- Returns a LIST<STRING> containing the STRING representations for all the property names of a MAP, NODE, or RELATIONSHIP.

  • labels() -- labels(input :: NODE) :: LIST<STRING> -- Returns a LIST<STRING> containing the STRING representations for all the labels of a NODE.

  • nodes() -- nodes(input :: PATH) :: LIST<NODE> -- Returns a LIST<NODE> containing all the NODE values in a PATH.

  • range() -- range(start :: INTEGER, end :: INTEGER [, step :: INTEGER]) :: LIST<INTEGER> -- Returns a LIST<INTEGER> comprising all INTEGER values within a specified range, optionally specifying a step length.

  • reduce() -- reduce(accumulator :: VARIABLE = initial :: ANY, variable :: VARIABLE IN list :: LIST<ANY> expression :: ANY) :: ANY -- Runs an expression against individual elements of a LIST<ANY>, storing the result of the expression in an accumulator.

  • relationships() -- relationships(input :: PATH) :: LIST<RELATIONSHIP> -- Returns a LIST<RELATIONSHIP> containing all the RELATIONSHIP values in a PATH.

  • reverse() -- reverse(input :: LIST<ANY>) :: LIST<ANY> -- Returns a LIST<ANY> in which the order of all elements in the given LIST<ANY> have been reversed.

  • tail() -- tail(input :: LIST<ANY>) :: LIST<ANY> -- Returns all but the first element in a LIST<ANY>.

  • toBooleanList() -- toBooleanList(input :: LIST<ANY>) :: LIST<BOOLEAN> -- Converts a LIST<ANY> of values to a LIST<BOOLEAN> values. If any values are not convertible to BOOLEAN they will be null in the LIST<BOOLEAN> returned.

  • toFloatList() -- toFloatList(input :: VECTOR | LIST<ANY>) :: LIST<FLOAT> -- Converts a LIST<ANY> to a LIST<FLOAT> values. If any values are not convertible to FLOAT they will be null in the LIST<FLOAT> returned.

  • toIntegerList() -- toIntegerList(input :: VECTOR | LIST<ANY>) :: LIST<INTEGER> -- Converts a LIST<ANY> to a LIST<INTEGER> values. If any values are not convertible to INTEGER they will be null in the LIST<INTEGER> returned.

  • toStringList() -- toStringList(input :: LIST<ANY>) :: LIST<STRING> -- Converts a LIST<ANY> to a LIST<STRING> values. If any values are not convertible to STRING they will be null in the LIST<STRING> returned.

LOAD CSV functions


LOAD CSV functions can be used to get information about the file that is processed by LOAD CSV.

  • file() -- file() :: STRING -- Returns the absolute path of the file that LOAD CSV is using.

  • linenumber() -- linenumber() :: INTEGER -- Returns the line number that LOAD CSV is currently using.

Mathematical functions

Logarithmic functions

These functions all operate on numerical expressions only, and will return an error if used on any other values.

  • e() -- e() :: FLOAT -- Returns the base of the natural logarithm, e.

  • exp() -- exp(input :: FLOAT) :: FLOAT -- Returns en, where e is the base of the natural logarithm, and n is the value of the argument expression.

  • log() -- log(input :: FLOAT) :: FLOAT -- Returns the natural logarithm of a FLOAT.

  • log10() -- log10(input :: FLOAT) :: FLOAT -- Returns the common logarithm (base 10) of a FLOAT.

  • sqrt() -- sqrt(input :: FLOAT) :: FLOAT -- Returns the square root of a FLOAT.

Numeric functions

These functions all operate on numerical expressions only, and will return an error if used on any other values.

  • abs() -- abs(input :: INTEGER | FLOAT) :: INTEGER | FLOAT -- Returns the absolute value of an INTEGER or FLOAT.

  • ceil() -- ceil(input :: FLOAT) :: FLOAT -- Returns the smallest FLOAT that is greater than or equal to a number and equal to an INTEGER.

  • floor() -- floor(input :: FLOAT) :: FLOAT -- Returns the largest FLOAT that is less than or equal to a number and equal to an INTEGER.

  • isNaN() -- isNaN(input :: INTEGER | FLOAT) :: BOOLEAN -- Returns true if the floating point number is NaN.

  • rand() -- rand() :: FLOAT -- Returns a random FLOAT in the range from 0 (inclusive) to 1 (exclusive).

  • round() -- round(input :: FLOAT [, precision :: INTEGER | FLOAT, mode :: STRING]) :: FLOAT -- Returns the value of a number rounded to the nearest INTEGER, optionally using a specified precision and rounding mode.

  • sign() -- sign(input :: INTEGER | FLOAT) :: INTEGER -- Returns the signum of an INTEGER or FLOAT: 0 if the number is 0, -1 for any negative number, and 1 for any positive number.

Trigonometric functions

These functions all operate on numerical expressions only, and will return an error if used on any other values.

All trigonometric functions operate on radians, unless otherwise specified.

  • acos() -- acos(input :: FLOAT) :: FLOAT -- Returns the arccosine of a FLOAT in radians.

  • asin() -- asin(input :: FLOAT) :: FLOAT -- Returns the arcsine of a FLOAT in radians.

  • atan() -- atan(input :: FLOAT) :: FLOAT -- Returns the arctangent of a FLOAT in radians.

  • atan2() -- atan2(y :: FLOAT, x :: FLOAT) :: FLOAT -- Returns the arctangent2 of a set of coordinates in radians.

  • cos() -- cos(input :: FLOAT) :: FLOAT -- Returns the cosine of a FLOAT.

  • cosh() -- cosh(input :: FLOAT) :: FLOAT -- Returns the hyperbolic cosine of a FLOAT. Cypher 25 only Introduced in Neo4j 2025.06

  • cot() -- cot(input :: FLOAT) :: FLOAT -- Returns the cotangent of a FLOAT.

  • coth() -- coth(input :: FLOAT) :: FLOAT -- Returns the hyperbolic cotangent of a FLOAT. Cypher 25 only Introduced in Neo4j 2025.06

  • degrees() -- degrees(input :: FLOAT) :: FLOAT -- Converts radians to degrees.

  • haversin() -- haversin(input :: FLOAT) :: FLOAT -- Returns half the versine of a number.

  • pi() -- pi() :: FLOAT -- Returns the mathematical constant pi.

  • radians() -- radians(input :: FLOAT) :: FLOAT -- Converts degrees to radians.

  • sin() -- sin(input :: FLOAT) :: FLOAT -- Returns the sine of a FLOAT.

  • sinh() -- sinh(input :: FLOAT) :: FLOAT -- Returns the hyperbolic sine of a FLOAT. Cypher 25 only Introduced in Neo4j 2025.06

  • tan() -- tan(input :: FLOAT) :: FLOAT -- Returns the tangent of a FLOAT.

  • tanh() -- tanh(input :: FLOAT) :: FLOAT -- Returns the hyperbolic tangent of a FLOAT. Cypher 25 only Introduced in Neo4j 2025.06

Predicate functions


These functions return either true or false for the given arguments.

  • all() -- all(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN -- Returns true if the predicate holds for all elements in the given LIST<ANY>.

  • allReduce() -- allReduce(accumulator = initial, stepVariable IN list | reductionFunction, predicate) :: BOOLEAN -- Returns true if, during the stepwise evaluation of a value across the elements in a given LIST<ANY>, the accumulated result satisfies a specified predicate at every step. Where that list is a group variable defined in a quantified path pattern, it allows for the early pruning of paths that do not satisfy the predicate. Cypher 25 only Introduced in Neo4j 2025.08

  • any() -- any(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN -- Returns true if the predicate holds for at least one element in the given LIST<ANY>.

  • exists() -- exists(input :: ANY) :: BOOLEAN -- Returns true if a match for the pattern exists in the graph.

  • isEmpty() -- isEmpty(input :: LIST<ANY> | MAP | STRING ) :: BOOLEAN -- Checks whether the given LIST<ANY>, MAP, or STRING is empty.

  • none() -- none(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN -- Returns true if the predicate holds for no element in the given LIST<ANY>.

  • single() -- single(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN -- Returns true if the predicate holds for exactly one of the elements in the given LIST<ANY>.

Scalar functions


These functions return a single value.

  • char_length() -- char_length(input :: STRING) :: INTEGER -- Returns the number of Unicode characters in a STRING.

  • character_length() -- character_length(input :: STRING) :: INTEGER -- Returns the number of Unicode characters in a STRING.

  • coalesce() -- coalesce(input :: ANY) :: ANY -- Returns the first non-null value in a list of expressions.

  • elementId() -- elementId(input :: NODE | RELATIONSHIP) :: STRING -- Returns a node or relationship identifier, unique within a specific transaction and DBMS.

  • endNode() -- endNode(input :: RELATIONSHIP) :: NODE -- Returns the end NODE of a RELATIONSHIP.

  • head() -- head(list :: LIST<ANY>) :: ANY -- Returns the first element in a LIST<ANY>.

  • id() -- id(input :: NODE | RELATIONSHIP) :: INTEGER -- - [ ] Deprecated Returns the id of a NODE or a RELATIONSHIP. Replaced by elementId(). -- - [x] last() -- last(list :: LIST<ANY>) :: ANY -- Returns the last element in a LIST`.

  • length() -- length(input :: PATH) :: INTEGER -- Returns the length of a PATH.

  • nullIf() -- nullIf(v1 :: ANY, v2 :: ANY) :: ANY -- Returns null if the two given parameters are equivalent, otherwise returns the value of the first parameter.

  • properties() -- properties(input :: NODE | RELATIONSHIP | MAP) :: MAP -- Returns a MAP containing all the properties of a NODE or RELATIONSHIP.

  • randomUUID() -- randomUUID() :: STRING -- Generates a random UUID.

  • size() -- size(input STRING | LIST<ANY>) :: INTEGER -- Returns the number of items in a LIST<ANY> or the number of Unicode characters in a STRING.

  • startNode() -- startNode(input :: RELATIONSHIP) :: NODE -- Returns the start NODE of a RELATIONSHIP.

  • timestamp() -- timestamp() :: INTEGER -- Returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

  • toBoolean() -- toBoolean(input :: BOOLEAN | STRING | INTEGER) :: BOOLEAN -- Converts a BOOLEAN, STRING, or an INTEGER value to a BOOLEAN value.

  • toBooleanOrNull() -- toBooleanOrNull(input :: ANY) :: BOOLEAN -- Converts a value to a BOOLEAN value, or null if the value cannot be converted.

  • toFloat() -- toFloat(input :: STRING | INTEGER | FLOAT) :: FLOAT -- Converts a STRING or INTEGER value to a FLOAT value.

  • toFloatOrNull() -- toFloatOrNull(input :: ANY) :: FLOAT -- Converts a value to a FLOAT value, or null if the value cannot be converted.

  • toInteger() -- toInteger(input :: BOOLEAN | STRING | INTEGER | FLOAT) :: INTEGER -- Converts a BOOLEAN, `STRING, or FLOAT value to an INTEGER value.

  • toIntegerOrNull() -- toIntegerOrNull(input :: ANY) :: INTEGER -- Converts a value to an INTEGER value, or null if the value cannot be converted.

  • type() -- type(input :: RELATIONSHIP) :: STRING -- Returns a STRING representation of the RELATIONSHIP type.

  • valueType() -- valueType(input :: ANY) :: STRING -- Returns a STRING representation of the most precise value type that the given expression evaluates to.

String functions


These functions are used to manipulate STRING values or to create a STRING representation of another value.

  • btrim() -- btrim(original :: STRING [, trimCharacterString :: STRING ]) :: STRING -- Returns the given STRING with leading and trailing whitespace removed, optionally specifying a trimCharacterString value to remove.

  • left() -- left(original :: STRING, length :: INTEGER) :: STRING -- Returns a STRING containing the specified number (INTEGER) of leftmost characters in the given STRING.

  • lower() -- lower(input :: STRING) :: STRING -- - [ ] Returns the given STRING in lowercase. This function is an alias to the toLower() function, and it was introduced as part of Cypher’s GQL conformance --

  • ltrim() -- ltrim(input :: STRING [, trimCharacterString :: STRING]) :: STRING -- Returns the given STRINGwith leading whitespace removed, optionally specifying atrimCharacterString` to remove.

  • normalize() -- normalize(input :: STRING [,normalForm = NFC :: [NFC, NFD, NFKC, NFKD]]) :: STRING -- Normalizes a STRING, optionally specifying a normalization form.

  • replace() -- replace(original :: STRING, search :: STRING, replace :: STRING) :: STRING -- Returns a STRING in which all occurrences of a specified search STRING in the given STRING have been replaced by another (specified) replacement STRING.

  • reverse() -- reverse(input :: STRING) :: STRING -- Returns a STRING in which the order of all characters in the given STRING have been reversed.

  • right() -- right(original :: STRING, length :: INTEGER) :: STRING -- Returns a STRING containing the specified number of rightmost characters in the given STRING.

  • rtrim() -- rtrim(input :: STRING [, trimCharacterString :: STRING]) :: STRING -- Returns the given STRING with trailing whitespace removed, optionally specifying a trimCharacterString of characters to remove.

  • split() -- split(original :: STRING, splitDelimiters :: LIST<STRING>) :: LIST<STRING> -- Returns a LIST<STRING> resulting from the splitting of the given STRING around matches of any of the given delimiters.

  • substring() -- substring(original :: STRING, start :: INTEGER length :: INTEGER) :: STRING -- Returns a substring of a given length from the given STRING, beginning with a 0-based index start.

  • toLower() -- toLower(input :: STRING) :: STRING -- Returns the given STRING in lowercase.

  • toString() -- toString(input :: ANY) :: STRING -- Converts an INTEGER, FLOAT, BOOLEAN, POINT or temporal type (i.e. DATE, ZONED TIME, LOCAL TIME, ZONED DATETIME, LOCAL DATETIME or DURATION) value to a STRING.

  • toStringOrNull() -- toStringOrNull(input :: ANY) :: STRING -- Converts an INTEGER, FLOAT, BOOLEAN, POINT or temporal type (i.e. DATE, ZONED TIME, LOCAL TIME, ZONED DATETIME, LOCAL DATETIME or DURATION) value to a STRING, or null if the value cannot be converted.

  • toUpper() -- toUpper(input :: STRING) :: STRING -- Returns the given STRING in uppercase.

  • trim() -- trim(trimCharacterString :: STRING, trimSpecification :: STRING, input :: STRING) :: STRING -- Returns the given STRING with the leading and/or trailing trimCharacterString character removed.

  • upper() -- upper(input :: STRING) :: STRING -- - [ ] Returns the given STRING in uppercase. This function is an alias to the toUpper() function, and it was introduced as part of Cypher’s GQL conformance --

Spatial function -- ----------------------------------------------------

These functions are used to specify 2D or 3D points in a geographic or cartesian Coordinate Reference System and to calculate the geodesic distance between two points.

  • point() -- point(input :: MAP) :: POINT -- Returns a 2D or 3D point object, given two or respectively three coordinate values in the Cartesian coordinate system or WGS 84 geographic coordinate system.

  • point.distance() -- point.distance(from :: POINT, to :: POINT) :: FLOAT -- Returns a FLOAT representing the distance between any two points in the same CRS. If the points are in the WGS 84 CRS, the function returns the geodesic distance (i.e., the shortest path along the curved surface of the Earth). If the points are in a Cartesian CRS, the function returns the Euclidean distance (i.e., the shortest straight-line distance in a flat, planar space).

  • point.withinBBox() -- point.withinBBox(point :: POINT, lowerLeft :: POINT, upperRight :: POINT) :: BOOLEAN -- Returns true if the provided point is within the bounding box defined by the two provided points, lowerLeft and upperRight.

Temporal functions

Duration functions

DURATION values of the temporal types can be created manipulated using the following functions:

  • duration() -- duration(input :: ANY) :: DURATION -- Constructs a DURATION value.

  • duration.between() -- duration.between(from :: ANY, to :: ANY) :: DURATION -- Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in logical units.

  • duration.inDays() -- duration.inDays(from :: ANY, to :: ANY) :: DURATION -- Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in days.

  • duration.inMonths() -- duration.inMonths(from :: ANY, to :: ANY) :: DURATION -- Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in months.

  • duration.inSeconds() -- duration.inSeconds(from :: ANY, to :: ANY) :: DURATION -- Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in seconds.

Instant type functions

Values of the temporal types — DATE, ZONED TIME, LOCAL TIME, ZONED DATETIME, and LOCAL DATETIME — can be created manipulated using the following functions:

  • date() -- date(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE -- Creates a DATE instant.

  • date.realtime() -- date.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE -- Returns the current DATE instant using the realtime clock.

  • date.statement() -- date.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE -- Returns the current DATE instant using the statement clock.

  • date.transaction() -- date.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE -- Returns the current DATE instant using the transaction clock.

  • date.truncate() -- date.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: DATE -- Truncates the given temporal value to a DATE instant using the specified unit.

  • datetime() -- datetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME -- Creates a ZONED DATETIME instant.

  • datetime.fromEpoch() -- datetime.fromEpoch(seconds :: INTEGER | FLOAT, nanoseconds :: INTEGER | FLOAT) :: ZONED DATETIME -- Creates a ZONED DATETIME given the seconds and nanoseconds since the start of the epoch.

  • datetime.fromEpochMillis() -- datetime.fromEpochMillis(milliseconds :: INTEGER | FLOAT) :: ZONED DATETIME -- Creates a ZONED DATETIME given the milliseconds since the start of the epoch.

  • datetime.realtime() -- datetime.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME -- Returns the current ZONED DATETIME instant using the realtime clock.

  • datetime.statement() -- datetime.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME -- Returns the current ZONED DATETIME instant using the statement clock.

  • datetime.transaction() -- datetime.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME -- Returns the current ZONED DATETIME instant using the transaction clock.

  • datetime.truncate() -- datetime.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: ZONED DATETIME -- Truncates the given temporal value to a ZONED DATETIME instant using the specified unit.

  • localdatetime() -- localdatetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME -- Creates a LOCAL DATETIME instant.

  • localdatetime.realtime() -- localdatetime.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME -- Returns the current LOCAL DATETIME instant using the realtime clock.

  • localdatetime.statement() -- localdatetime.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME -- Returns the current LOCAL DATETIME instant using the statement clock.

  • localdatetime.transaction() -- localdatetime.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME -- Returns the current LOCAL DATETIME instant using the transaction clock.

  • localdatetime.truncate() -- localdatetime.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: LOCAL DATETIME -- Truncates the given temporal value to a LOCAL DATETIME instant using the specified unit.

  • localtime() -- localtime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME -- Creates a LOCAL TIME instant.

  • localtime.realtime() -- localtime.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME -- Returns the current LOCAL TIME instant using the realtime clock.

  • localtime.statement() -- localtime.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME -- Returns the current LOCAL TIME instant using the statement clock.

  • localtime.transaction() -- localtime.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME -- Returns the current LOCAL TIME instant using the transaction clock.

  • localtime.truncate() -- localtime.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: LOCAL TIME -- Truncates the given temporal value to a LOCAL TIME instant using the specified unit.

  • time() -- time(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME -- Creates a ZONED TIME instant.

  • time.realtime() -- time.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME -- Returns the current ZONED TIME instant using the realtime clock.

  • time.statement() -- time.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME -- Returns the current ZONED TIME instant using the statement clock.

  • time.transaction() -- time.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME -- Returns the current ZONED TIME instant using the transaction clock.

  • time.truncate() -- time.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: ZONED TIME -- Truncates the given temporal value to a ZONED TIME instant using the specified unit.

Format functions

These functions format temporal instance and duration values:

  • format() -- format(value :: DATE | LOCAL TIME | ZONED TIME | LOCAL DATETIME | ZONED DATETIME | DURATION[, pattern :: STRING]) :: STRING -- Returns the temporal value as an ISO-formatted STRING or as a STRING formatted by the provided pattern.

User-defined functions

User-defined functions are written in Java, deployed into the database and are called in the same way as any other Cypher function. There are two main types of functions that can be developed and used:

Vector functions


Vector functions allow you to compute the similarity scores of vector pairs.

  • vector() -- vector(vectorValue :: STRING | LIST<INTEGER | FLOAT>, dimension :: INTEGER, coordinateType :: [INTEGER64, INTEGER32, INTEGER16, INTEGER8, FLOAT64, FLOAT32]) :: VECTOR -- Constructs a VECTOR` value. Cypher 25 only Introduced in Neo4j 2025.10

  • vector.similarity.cosine() -- vector.similarity.cosine(a :: VECTOR | LIST<INTEGER | FLOAT>, b :: VECTOR | LIST<INTEGER | FLOAT>) :: FLOAT -- Returns a FLOAT representing the similarity between the argument vectors based on their cosine.

  • vector.similarity.euclidean() -- vector.similarity.euclidean(a :: VECTOR | LIST<INTEGER | FLOAT>, b :: VECTOR | LIST<INTEGER | FLOAT>) :: FLOAT -- Returns a FLOAT representing the similarity between the argument vectors based on their Euclidean distance.

  • vector_dimension_count() -- (vector :: VECTOR) :: INTEGER -- Returns the dimension of a VECTOR. Cypher 25 only Introduced in Neo4j 2025.10

  • vector_distance() -- (vector1 :: VECTOR, vector2 :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, EUCLIDEAN_SQUARED, MANHATTAN, COSINE, DOT, HAMMING]) :: FLOAT -- Returns a FLOAT representing the distance between the two vector values based on the selected vectorDistanceMetric algorithm. Cypher 25 only Introduced in Neo4j 2025.10

  • vector_norm() -- vector_norm(vector :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, MANHATTAN]) :: FLOAT -- Returns a FLOAT representing the distance between the given vector and a vector of the same dimension with all coordinates set to zero, calculated using the specified vectorDistanceMetric. Cypher 25 only Introduced in Neo4j 2025.10

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions