Functions
This section contains information on all functions in the Cypher® query language.
Related information may be found in Operators.
|
To list the available functions, run the following Cypher query:
SHOW FUNCTIONS
These functions return either true or false for the given arguments.
Function | Signature | Description |
---|---|---|
|
Returns true if the predicate holds for all elements in the given list. |
|
|
Returns true if the predicate holds for at least one element in the given list. |
|
|
Returns |
|
|
Checks whether a list is empty. |
|
|
Checks whether a map is empty. |
|
|
Checks whether a string is empty. |
|
|
Returns true if the predicate holds for no element in the given list. |
|
|
Returns true if the predicate holds for exactly one of the elements in the given list. |
These functions return a single value.
Function | Signature | Description |
---|---|---|
|
Returns the first non-null value in a list of expressions. |
|
|
Returns the end node of a relationship. |
|
|
Returns the first element in a list. |
|
|
Deprecated Returns the id of a node. Replaced by |
|
|
Deprecated Returns the id of a relationship. Replaced by |
|
|
Returns the last element in a list. |
|
|
Returns the length of a path. |
|
|
Returns a map containing all the properties of a map. |
|
|
Returns a map containing all the properties of a node. |
|
|
Returns a map containing all the properties of a relationship. |
|
|
Generates a random UUID. |
|
|
Returns the number of items in a list. |
|
|
Returns the number of Unicode characters in a string. |
|
|
Returns the start node of a relationship. |
|
|
Converts a string value to a boolean value. |
|
|
Converts a boolean value to a boolean value. |
|
|
Converts an integer value to a boolean value. |
|
|
Converts a value to a boolean value, or null if the value cannot be converted. |
|
|
Converts a number value to a floating point value. |
|
|
Converts a string value to a floating point value. |
|
|
Converts a value to a floating point value, or null if the value cannot be converted. |
|
|
Converts a number value to an integer value. |
|
|
Converts a boolean value to an integer value. |
|
|
Converts a string value to an integer value. |
|
|
Converts a value to an integer value, or null if the value cannot be converted. |
|
|
Returns the string representation of the relationship type. |
These functions take multiple values as arguments, and calculate and return an aggregated value from them.
Function | Signature | Description |
---|---|---|
|
Returns the average of a set of duration values. |
|
|
Returns the average of a set of floating point values. |
|
|
Returns the average of a set of integer values. |
|
|
Returns a list containing the values returned by an expression. |
|
|
Returns the number of values or rows. |
|
|
Returns the maximum value in a set of values. |
|
|
Returns the minimum value in a set of values. |
|
|
Returns the percentile of a value over a group using linear interpolation. |
|
|
Returns the nearest floating point value to the given percentile over a group using a rounding method. |
|
|
Returns the nearest integer value to the given percentile over a group using a rounding method. |
|
|
Returns the standard deviation for the given value over a group for a sample of a population. |
|
|
Returns the standard deviation for the given value over a group for an entire population. |
|
|
Returns the sum of a set of durations |
|
|
Returns the sum of a set of floats |
|
|
Returns the sum of a set of integers |
These functions return lists of other values. Further details and examples of lists may be found in Lists.
Function | Signature | Description |
---|---|---|
|
Returns a list containing the string representations for all the property names of a map. |
|
|
Returns a list containing the string representations for all the property names of a node. |
|
|
Returns a list containing the string representations for all the property names of a relationship. |
|
|
Returns a list containing the string representations for all the labels of a node. |
|
|
Returns a list containing all the nodes in a path. |
|
|
Returns a list comprising all integer values within a specified range. |
|
|
Returns a list comprising all integer values within a specified range created with step length. |
|
|
Runs an expression against individual elements of a list, storing the result of the expression in an accumulator. |
|
|
Returns a list containing all the relationships in a path. |
|
|
Returns a list in which the order of all elements in the original list have been reversed. |
|
|
Returns all but the first element in a list. |
|
|
Converts a list of values to a list of boolean values. If any values are not convertible to boolean they will be null in the list returned. |
|
|
Converts a list of values to a list of floating point values. If any values are not convertible to floating point they will be null in the list returned. |
|
|
Converts a list of values to a list of integer values. If any values are not convertible to integer they will be null in the list returned. |
|
|
Converts a list of values to a list of string values. If any values are not convertible to string they will be null in the list returned. |
These functions all operate on numerical expressions only, and will return an error if used on any other values.
Function | Signature | Description |
---|---|---|
|
Returns the absolute value of a floating point number. |
|
|
Returns the absolute value of an integer. |
|
|
Returns the smallest floating point number that is greater than or equal to a number and equal to a mathematical integer. |
|
|
Returns the largest floating point number that is less than or equal to a number and equal to a mathematical integer. |
|
|
Returns |
|
|
Returns |
|
|
Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e. [0,1). |
|
|
Returns the value of a number rounded to the nearest integer. |
|
|
Returns the value of a number rounded to the specified precision using rounding mode HALF_UP. |
|
|
Returns the value of a number rounded to the specified precision with the specified rounding mode. |
|
|
Returns the signum of a floating point number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number. |
|
|
Returns the signum of an integer number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number. |
These functions all operate on numerical expressions only, and will return an error if used on any other values.
Function | Signature | Description |
---|---|---|
|
Returns the base of the natural logarithm, e. |
|
|
Returns en, where e is the base of the natural logarithm, and n is the value of the argument expression. |
|
|
Returns the natural logarithm of a number. |
|
|
Returns the common logarithm (base 10) of a number. |
|
|
Returns the square root of a number. |
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.
Function | Signature | Description |
---|---|---|
|
Returns the arccosine of a number in radians. |
|
|
Returns the arcsine of a number in radians. |
|
|
Returns the arctangent of a number in radians. |
|
|
Returns the arctangent2 of a set of coordinates in radians. |
|
|
Returns the cosine of a number. |
|
|
Returns the cotangent of a number. |
|
|
Converts radians to degrees. |
|
|
Returns half the versine of a number. |
|
|
Returns the mathematical constant pi. |
|
|
Converts degrees to radians. |
|
|
Returns the sine of a number. |
|
|
Returns the tangent of a number. |
These functions are used to manipulate strings or to create a string representation of another value.
Function | Signature | Description |
---|---|---|
|
Returns a string containing the specified number of leftmost characters of the original string. |
|
|
Returns the original string with leading whitespace removed. |
|
|
Returns a string in which all occurrences of a specified search string in the original string have been replaced by another (specified) replace string. |
|
|
Returns a string in which the order of all characters in the original string have been reversed. |
|
|
Returns a string containing the specified number of rightmost characters of the original string. |
|
|
Returns the original string with trailing whitespace removed. |
|
|
Returns a list of strings resulting from the splitting of the original string around matches of the given delimiter. |
|
|
Returns a list of strings resulting from the splitting of the original string around matches of any of the given delimiters. |
|
|
Returns a substring of the original string, beginning with a 0-based index start. |
|
|
Returns a substring of length 'length' of the original string, beginning with a 0-based index start. |
|
|
Returns the original string in lowercase. |
|
|
Converts an integer, float, boolean, point or temporal type (i.e. Date, Time, LocalTime, DateTime, LocalDateTime or Duration) value to a string. |
|
|
Converts an integer, float, boolean, point or temporal type (i.e. Date, Time, LocalTime, DateTime, LocalDateTime or Duration) value to a string, or null if the value cannot be converted. |
|
|
Returns the original string in uppercase. |
|
|
Returns the original string with leading and trailing whitespace removed. |
Values of the temporal types — Date, Time, LocalTime, DateTime, and LocalDateTime — can be created manipulated using the following functions:
Function | Signature | Description |
---|---|---|
|
Create a Date instant. |
|
|
Get the current Date instant using the realtime clock. |
|
|
Get the current Date instant using the statement clock. |
|
|
Get the current Date instant using the transaction clock. |
|
|
Truncate the input temporal value to a Date instant using the specified unit. |
|
|
Create a DateTime instant. |
|
|
Create a DateTime given the seconds and nanoseconds since the start of the epoch. |
|
|
Create a DateTime given the milliseconds since the start of the epoch. |
|
|
Get the current DateTime instant using the realtime clock. |
|
|
Get the current DateTime instant using the statement clock. |
|
|
Get the current DateTime instant using the transaction clock. |
|
|
Truncate the input temporal value to a DateTime instant using the specified unit. |
|
|
Create a LocalDateTime instant. |
|
|
Get the current LocalDateTime instant using the realtime clock. |
|
|
Get the current LocalDateTime instant using the statement clock. |
|
|
Get the current LocalDateTime instant using the transaction clock. |
|
|
Truncate the input temporal value to a LocalDateTime instant using the specified unit. |
|
|
Create a LocalTime instant. |
|
|
Get the current LocalTime instant using the realtime clock. |
|
|
Get the current LocalTime instant using the statement clock. |
|
|
Get the current LocalTime instant using the transaction clock. |
|
|
Truncate the input temporal value to a LocalTime instant using the specified unit. |
|
|
Create a Time instant. |
|
|
Get the current Time instant using the realtime clock. |
|
|
Get the current Time instant using the statement clock. |
|
|
Get the current Time instant using the transaction clock. |
|
|
Truncate the input temporal value to a Time instant using the specified unit. |
Duration values of the temporal types can be created manipulated using the following functions:
Function | Signature | Description |
---|---|---|
|
Construct a Duration value. |
|
|
Compute the duration between the 'from' instant (inclusive) and the 'to' instant (exclusive) in logical units. |
|
|
Compute the duration between the 'from' instant (inclusive) and the 'to' instant (exclusive) in days. |
|
|
Compute the duration between the 'from' instant (inclusive) and the 'to' instant (exclusive) in months. |
|
|
Compute the duration between the 'from' instant (inclusive) and the 'to' instant (exclusive) in seconds. |
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.
Function | Signature | Description |
---|---|---|
|
Returns a floating point number representing the geodesic distance between any two points in the same CRS. |
|
|
Returns a 2D point object, given two coordinate values in the Cartesian coordinate system. |
|
|
Returns a 3D point object, given three coordinate values in the Cartesian coordinate system. |
|
|
Returns a 2D point object, given two coordinate values in the WGS 84 geographic coordinate system. |
|
|
Returns a 3D point object, given three coordinate values in the WGS 84 geographic coordinate system. |
|
|
Returns |
LOAD CSV functions can be used to get information about the file that is processed by LOAD CSV
.
Function | Signature | Description |
---|---|---|
|
Returns the absolute path of the file that LOAD CSV is using. |
|
|
Returns the line number that LOAD CSV is currently using. |
Graph functions provide information about the constituent graphs in composite databases.
Function | Signature | Description |
---|---|---|
|
Returns a list containing the names of all graphs in the current composite database. |
|
|
Returns a map containing the properties associated with the given graph. |
|
|
Resolves a constituent graph by name. |
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:
Type | Description | Usage | Developing |
---|---|---|---|
Scalar |
For each row the function takes parameters and returns a result. |
||
Aggregating |
Consumes many rows and produces an aggregated result. |
Was this page helpful?