Functions
Related information may be found in Operators.
-
Functions in Cypher® return
null
if an input parameter isnull
. -
Functions taking a string as input all operate on Unicode characters rather than on a standard
char[]
. For example, thesize()
function applied to any Unicode character will return 1, even if the character does not fit in the 16 bits of onechar
.
These functions return either true or false for the given arguments.
Function | Description |
---|---|
Tests whether the predicate holds for all elements in a list. |
|
Tests whether the predicate holds for at least one element in a list. |
|
Returns true if a match for the pattern exists in the graph, or if the specified property exists in the node, relationship or map. |
|
Returns true if the predicate holds for no element in a list. |
|
Returns true if the predicate holds for exactly one of the elements in a list. |
These functions return a single value.
Function | Description |
---|---|
Returns the first non- |
|
Returns the end node of a relationship. |
|
Returns the first element in a list. |
|
Returns the id of a relationship or node. |
|
Returns the last element in a list. |
|
Returns the length of a path. |
|
Returns a map containing all the properties of a node or relationship. |
|
Returns a string value corresponding to a randomly-generated UUID. |
|
Returns the number of items in a list. |
|
Returns the number of paths matching the pattern expression. |
|
Returns the number of Unicode characters in a string. |
|
Returns the start node of a relationship. |
|
Returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. |
|
Converts a string value to a boolean value. |
|
Converts an integer or string value to a floating point number. |
|
Converts a floating point or string value to an integer value. |
|
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 | Description |
---|---|
Returns the average of a set of numeric values. |
|
Returns the average of a set of Durations. |
|
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 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 numeric values. |
|
Returns the sum of a set of Durations. |
These functions return lists of other values. Further details and examples of lists may be found in Lists.
Function | Description |
---|---|
Returns a list containing the string representations for all the property names of a node, relationship, or map. |
|
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. |
|
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. |
These functions all operate on numerical expressions only, and will return an error if used on any other values.
Function | Description |
---|---|
Returns the absolute value of a number. |
|
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 a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e. |
|
Returns the value of a number rounded to the nearest integer. |
|
Returns the signum of a number: |
These functions all operate on numerical expressions only, and will return an error if used on any other values.
Function | Description |
---|---|
Returns the base of the natural logarithm, |
|
Returns |
|
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 | 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 | 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 string in the original string have been replaced by another (specified) 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 substring of the original string, beginning with a 0-based index start and length. |
|
Returns the original string in lowercase. |
|
Converts an integer, float, boolean or temporal type (i.e. Date, Time, LocalTime, DateTime, LocalDateTime or Duration) value to a string. |
|
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 | Description |
---|---|
Returns the current Date. |
|
Returns the current Date using the |
|
Returns the current Date using the |
|
Returns the current Date using the |
|
Returns a calendar (Year-Month-Day) Date. |
|
Returns a week (Year-Week-Day) Date. |
|
Returns a quarter (Year-Quarter-Day) Date. |
|
Returns an ordinal (Year-Day) Date. |
|
Returns a Date by parsing a string. |
|
Returns a Date from a map of another temporal value’s components. |
|
Returns a Date obtained by truncating a value at a specific component boundary. Truncation summary. |
|
Returns the current DateTime. |
|
Returns the current DateTime using the |
|
Returns the current DateTime using the |
|
Returns the current DateTime using the |
|
Returns a calendar (Year-Month-Day) DateTime. |
|
Returns a week (Year-Week-Day) DateTime. |
|
Returns a quarter (Year-Quarter-Day) DateTime. |
|
Returns an ordinal (Year-Day) DateTime. |
|
Returns a DateTime by parsing a string. |
|
Returns a DateTime from a map of another temporal value’s components. |
|
Returns a DateTime from a timestamp. |
|
Returns a DateTime obtained by truncating a value at a specific component boundary. Truncation summary. |
|
Returns the current LocalDateTime. |
|
Returns the current LocalDateTime using the |
|
Returns the current LocalDateTime using the |
|
Returns the current LocalDateTime using the |
|
Returns a calendar (Year-Month-Day) LocalDateTime. |
|
Returns a week (Year-Week-Day) LocalDateTime. |
|
Returns a quarter (Year-Quarter-Day) DateTime. |
|
Returns an ordinal (Year-Day) LocalDateTime. |
|
Returns a LocalDateTime by parsing a string. |
|
Returns a LocalDateTime from a map of another temporal value’s components. |
|
Returns a LocalDateTime obtained by truncating a value at a specific component boundary. Truncation summary. |
|
Returns the current LocalTime. |
|
Returns the current LocalTime using the |
|
Returns the current LocalTime using the |
|
Returns the current LocalTime using the |
|
Returns a LocalTime with the specified component values. |
|
Returns a LocalTime by parsing a string. |
|
Returns a LocalTime from a map of another temporal value’s components. |
|
Returns a LocalTime obtained by truncating a value at a specific component boundary. Truncation summary. |
|
Returns the current Time. |
|
Returns the current Time using the |
|
Returns the current Time using the |
|
Returns the current Time using the |
|
Returns a Time with the specified component values. |
|
Returns a Time by parsing a string. |
|
Returns a Time from a map of another temporal value’s components. |
|
Returns a Time obtained by truncating a value at a specific component boundary. Truncation summary. |
Duration values of the temporal types can be created manipulated using the following functions:
Function | Description |
---|---|
Returns a Duration from a map of its components. |
|
Returns a Duration by parsing a string. |
|
Returns a Duration equal to the difference between two given instants. |
|
Returns a Duration equal to the difference in whole months, quarters or years between two given instants. |
|
Returns a Duration equal to the difference in whole days or weeks between two given instants. |
|
Returns a Duration equal to the difference in seconds and fractions of seconds, or minutes or hours, between two given instants. |
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 | 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. |
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 |
LOAD CSV functions can be used to get information about the file that is processed by LOAD CSV
.
Function | Description |
---|---|
Returns the line number that |
|
Returns the absolute path of the file that |