Neo4j: Scalar functions Cheat Sheet

coalesce()

returns the first non-null value in the given list of expressions.

coalesce(expression [, expression]*)

expression: An expression which may return null.

endNode()

returns the end node of a relationship.

endNode(relationship)

head()

returns the first element in a list.

head(list)

id()

returns the id of a relationship or node.

id(expression)

last()

returns the last element in a list.

last(expression)

length()

returns the length of a path.

length(path)

properties() 

returns a map containing all the properties of a node or relationship. If the argument is already a map, it is returned unchanged.

properties(expression)

randomUUID()

returns a randomly-generated Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID). This is a 128-bit value with strong guarantees of uniqueness.

randomUUID()

size()

returns the number of elements in a list.

size(list)

size() applied to pattern expression

This is the same size() method as described above, but instead of passing in a list directly, a pattern expression can be provided that can be used in a match query to provide a new set of results. These results are a list of paths. The size of the result is calculated, not the length of the expression itself.

size(pattern expression)

size() applied to string

returns the number of Unicode characters in a string.

size(string)

startNode()

returns the start node of a relationship.

startNode(relationship)

timestamp()

returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. It is the equivalent of datetime().epochMillis

timestamp()

toBoolean()

converts a string value to a boolean value.

toBoolean(expression)

toFloat()

converts an integer or string value to a floating point number.

toFloat(expression)

toInteger()

converts a floating point or string value to an integer value.

toInteger(expression)

type()

returns the string representation of the relationship type.

type(relationship)

Leave a Reply

Your email address will not be published. Required fields are marked *