Quine Cypher Functions¶
Built-In Cypher Functions¶
These are functions that are part of the Cypher language.
Predicate Functions¶
Predicate functions return either true or false for the given arguments.
| Function | Syntax | Description |
|---|---|---|
IS NOT NULL |
property IS NOT NULL |
Returns true if the specified property exists in the node, relationship or map. |
Scalar Functions¶
Scalar functions return a single value.
| Function | Syntax | Description |
|---|---|---|
coalesce() |
coalesce(expression [, expression]*) |
Returns the first non-null value in a list of expressions. |
endNode() |
endNode(relationship) |
Returns the end node of a relationship. |
head() |
head(list) |
Returns the first element in a list. |
id() |
id(expression) |
Returns the id of a relationship or node. |
last() |
last(expression) |
Returns the last element in a list. |
length() |
length(path) |
Returns the length of a path. |
properties() |
properties(expression) |
Returns a map containing all the properties of a node or relationship. |
size() |
size(list) |
Returns the number of items in a list. |
size() |
size(pattern expression) |
Applied to pattern expression, returns the number of sub-graphs matching the pattern expression. |
size() |
size(string) |
Applied to string, returns the size of a string. |
startNode() |
startNode(relationship) |
Returns the start node of a relationship. |
timestamp() |
timestamp() |
Returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. |
toBoolean() |
toBoolean(expression) |
Converts a string value to a boolean value. |
toFloat() |
toFloat(expression) |
Converts an integer or string value to a floating point number. |
toInteger() |
toInteger(expression) |
Converts a floating point or string value to an integer value. |
type() |
type(relationship) |
Returns the string representation of the relationship type. |
Aggregating Functions¶
These functions take multiple values as arguments, and calculate and return an aggregated value from them.
| Function | Syntax | Description |
|---|---|---|
avg() |
avg(expression) |
Returns the average of a set of numeric values. |
collect() |
collect(expression) |
Returns a list containing the values returned by an expression. |
count() |
count(expression) |
Returns the number of values or records. |
max() |
max(expression) |
Returns the maximum value in a set of values. |
min() |
min(expression) |
Returns the minimum value in a set of values. |
percentileCont() |
percentileCont(expression, percentile) |
Returns the percentile of a value over a group using linear interpolation. |
percentileDisc() |
percentileDisc(expression, percentile) |
Returns the nearest value to the given percentile over a group using a rounding method. |
stDev() |
stDev(expression) |
Returns the standard deviation for the given value over a group for a sample of a population. |
stDevP() |
stDevP(expression) |
Returns the standard deviation for the given value over a group for an entire population. |
sum() |
sum(expression) |
Returns the sum of a set of numeric values. |
List Functions¶
These functions return lists of other values.
| Function | Syntax | Description |
|---|---|---|
keys() |
keys(expression) |
Returns a list containing the string representations for all the property names of a node, relationship, or map. |
labels() |
labels(node) |
Returns a list containing the string representations for all the labels of a node. |
nodes() |
nodes(path) |
Returns a list containing all the nodes in a path. |
range() |
range(start, end [, step]) |
Returns a list comprising all integer values within a specified range. |
relationships() |
relationships(path) |
Returns a list containing all the relationships in a path. |
reverse() |
reverse(original) |
Returns a list in which the order of all elements in the original list have been reversed. |
tail() |
tail(list) |
Returns all but the first element in a list. |
Mathematical Functions¶
These numeric functions all operate on numerical expressions only, and will return an error if used on any other values.
| Function | Syntax | Description |
|---|---|---|
abs() |
abs(expression) |
Returns the absolute value of a number. |
ceil() |
ceil(expression) |
Returns the smallest floating point number that is greater than or equal to a number and equal to a mathematical integer. |
floor() |
floor(expression) |
Returns the largest floating point number that is less than or equal to a number and equal to a mathematical integer. |
rand() |
rand() |
Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e. [0,1). |
round() |
round(expression [, precision, mode]) |
Returns the floating point value of a number rounded to the nearest integer, or optionally as specified by precision and mode. precision should be an integer. Rounding mode should be one of: UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, or UNNECESSARY. The default rounding mode is HALF_UP. |
sign() |
sign(expression) |
Returns the signum of a number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number. |
These logarithmic functions all operate on numerical expressions only, and will return an error if used on any other values.
| Function | Syntax | Description |
|---|---|---|
e() |
e() |
Returns the base of the natural logarithm, e. |
exp() |
exp(expression) |
Returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression. |
log() |
log(expression) |
Returns the natural logarithm of a number. |
log10() |
log10(expression) |
Returns the common logarithm (base 10) of a number. |
sqrt() |
sqrt(expression) |
Returns the square root of a number. |
All trigonometric functions operate on radians, unless otherwise specified.
| Function | Syntax | Description |
|---|---|---|
acos() |
acos(expression) |
Returns the arccosine of a number in radians. |
asin() |
asin(expression) |
Returns the arcsine of a number in radians. |
atan() |
atan(expression) |
Returns the arctangent of a number in radians. |
atan2() |
atan2(expression1, expression2) |
Returns the arctangent2 of a set of coordinates in radians. |
cos() |
cos(expression) |
Returns the cosine of a number. |
cot() |
cot(expression) |
Returns the cotangent of a number. |
degrees() |
degrees(expression) |
Converts radians to degrees. |
pi() |
pi() |
Returns the mathematical constant pi. |
radians() |
radians(expression) |
Converts degrees to radians. |
sin() |
sin(expression) |
Returns the sine of a number. |
tan() |
tan(expression) |
Returns the tangent of a number. |
String Functions¶
These functions are used to manipulate strings or to create a string representation of another value.
| Function | Syntax | Description |
|---|---|---|
left() |
left(original, length) |
Returns a string containing the specified number of leftmost characters of the original string. |
lTrim() |
lTrim(original) |
Returns the original string with leading whitespace removed. |
replace() |
replace(original, search, replace) |
Returns a string in which all occurrences of a specified string in the original string have been replaced by another (specified) string. |
reverse() |
reverse(original) |
Returns a string in which the order of all characters in the original string have been reversed. |
right() |
right(original, length) |
Returns a string containing the specified number of rightmost characters of the original string. |
rTrim() |
rTrim(original) |
Returns the original string with trailing whitespace removed. |
split() |
split(original, splitDelimiter) |
Returns a list of strings resulting from the splitting of the original string around matches of the given delimiter. |
substring() |
substring(original, start [, length]) |
Returns a substring of the original string, beginning with a 0-based index start and length. |
toLower() |
toLower(original) |
Returns the original string in lowercase. |
toString() |
toString(expression) |
Converts an integer, float or boolean value to a string. |
toUpper() |
toUpper(original) |
Returns the original string in uppercase. |
trim() |
trim(original) |
Returns the original string with leading and trailing whitespace removed. |
Custom Cypher Functions¶
These are the default additional functions that come with Quine: