Cypher Functions
This section describes AnzoGraph compatibility with the Cypher Language specification for Cypher functions.
- Predicate Functions (Partially Supported)
- Scalar Functions (Partially Supported)
- Aggregating Functions (Partially Supported)
- List Functions (Not Supported)
- Mathematical Numeric Functions (Partially Supported)
- Mathematical Logarithmic Functions (Partially Supported)
- Mathematical Trigonometric Functions (Partially Supported)
- String Functions (Partially Supported)
- User-defined Functions (Not Supported)
- Comments (Supported)
- Compatibility and Versioning (Not Supported)
Predicate Functions (Partially Supported)
Cypher predicate functions include the following:
Function | Description |
---|---|
exists() | Returns true if the specified property exists in the node, relationship, or map. |
These functions return either true or false for the given arguments.
Operations using exists expr or not exists expr are not currently supported in AnzoGraph.
Scalar Functions (Partially Supported)
Cypher functions that return a single value include the following:
Function | Description |
---|---|
coalesce() | Returns the first non-null value in a list of expressions. |
endNode() | Returns the end node of a relationship. |
head() | Returns the first element in a list. Not supported in the current AnzoGraph release. |
id() | Returns the id of a relationship or node. In AnzoGraph, nodes have a unique integer identifier, however, relationships do not; so id() on relationships is not available. Relationships can, however, be uniquely identified by their start and end node IDs and relationship type. |
last() | Returns the last element in a list. The List type is not supported in the current AnzoGraph release, so functions on lists are also not supported. |
length() | Returns the length of a path. Paths are not supported in the current AnzoGraph release, so functions on path arguments are also not supported. |
properties() | Returns a map containing all the properties of a node or relationship. Paths are not supported in the current AnzoGraph release, so functions on path arguments are also not supported. |
size() | Returns the number of items in a list. When applied to a pattern expression, the function returns the number of sub-graphs matching the pattern expression. When applied to a string, the function returns the size of a string. The List type is not supported in the current AnzoGraph release, so functions operating on lists are also not supported. |
startNode() | Returns the start node of a relationship. |
timestamp() | Returns the difference, measured in milliseconds, between the current time and midnight January 1 1970 UTC. Date/time functions are not supported in the current AnzoGraph release. |
toBoolean() | Converts a string value to a boolean value. |
toFloat() | Converts an integer or string value to a floating point number. |
toInteger() | Converts a floating point or string value to an integer value. |
type() | Returns the string representation of the relationship type. |
Aggregating Functions (Partially Supported)
Aggregating functions accept multiple values as arguments, then calculate and return an aggregated result value.
Function | Description |
---|---|
avg() | Returns the average of a set of numeric values. |
collect() | Returns a list containing the values returned by an expression. The List type is not supported in the current release, so functions operating on lists are also not supported. |
count() | Returns the number of values or records. |
max() | Returns the maximum value in a set of values. The List type is not supported in the current release, so functions operating on lists are also not supported. |
min() | Returns the minimum value in a set of values. In the current AnzoGraph release, there is a result mismatch for min(val) due to different orderability behavior. The current AnzoGraph release also does not support operations on lists. |
percentileCont() | Returns the percentile of a value over a group using linear interpolation. The percentileCont() function is partially supported in the current AnzoGraph release, with the percentileCont() function supported with the GROUP BY clause. |
percentileDisc() | Returns the nearest value to a specified percentile over a group using a rounding method. The percentileDisc() function is partially supported in the current AnzoGraph release, with the percentileDisc() function supported with the GROUP BY clause. |
stDev() | Returns the standard deviation for a given value over a group for a sample of a population. |
stDevP() | Returns the standard deviation for a given value over a group for an entire population. |
sum() | Returns the sum of a set of numeric values. |
List Functions (Not Supported)
Cypher List functions include the following:
The List type is not supported in the current AnzoGraph release, so functions operating on lists are also not supported.
Function | Description |
---|---|
keys() | Returns a list containing the string representations for all the property names of a node relationship or map. |
labels() | Returns a list containing the string representations for all the labels of a node. |
nodes() | Returns a list containing all the nodes in a path. |
range() | Returns a list comprising all integer values within a specified range. |
relationships() | Returns a list containing all the relationships in a path. |
reverse() | Returns a list in which the order of all elements in the original list have been reversed. |
tail() | Returns all but the first element in a list. |
Mathematical Numeric Functions (Partially Supported)
Cypher mathematical numeric functions all operate only on numeric expressions. They will return an error if used with any other values.
Function | Description |
---|---|
abs() | Returns the absolute value of a number. |
ceil() | Returns the smallest floating point number that is greater than or equal to a number and equal to a mathematical integer. |
floor() | Returns the largest floating point number that is less than or equal to a number and equal to a mathematical integer. |
rand() | Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); that is [0 ; 1). |
round() | Returns the value of a number rounded to the nearest integer. |
sign() | Returns the sign of a number: returns 0 if the number is 0; returns -1 for any negative number; and returns 1 for any positive number. The sign() function is not supported in the current release. |
Mathematical Logarithmic Functions (Partially Supported)
Cypher mathematical logarithmic functions all operate only on numeric expressions. They will return an error if used with any other values.
Function | Description |
---|---|
e() | Returns the base of the natural logarithm. The e() function is not supported in the current release. |
exp() | Returns e^n where e is the base of the natural logarithm and n is the value of the argument expression. |
log() | Returns the natural logarithm of a number. |
log10() | Returns the common logarithm (base 10) of a number. |
sqrt() | Returns the square root of a number. |
Mathematical Trigonometric Functions (Partially Supported)
Cypher mathematical trigonometric functions all operate only on numeric expressions. They will return an error if used with any other values.
Function | Description |
---|---|
acos() | Returns the arccosine of a number in radians. (See note below.) |
asin() | Returns the arcsine of a number in radians. (See note below.) |
atan() | Returns the arctangent of a number in radians. (See note below.) |
atan2() | Returns the arctangent2 of a set of coordinates in radians. (See note below.) |
cos() | Returns the cosine of a number. |
cot() | Returns the cotangent of a number. (See note below.) |
degrees() | Converts radians to degrees. (See note below.) |
pi() | Returns the mathematical constant pi. |
radians() | Converts degrees to radians. |
sin() | Returns the sine of a number. |
tan() | Returns the tangent of a number. |
The acos, asin, atan, atan2, cot, and degrees functions are not supported in the current AnzoGraph release.
String Functions (Partially Supported)
Cypher string functions all operate only on string expressions. They will return an error if used with any other values. The exception to this rule is toString(), which also accepts numbers and booleans as arguments.
Function | Description |
---|---|
left() | Returns a string containing the specified number of left-most characters of the original string. |
lTrim() | Returns the original string with leading whitespace removed. |
replace() | Returns a string in which all occurrences of a specified string in the original string have been replaced by another specified string. |
reverse() | Returns a string in which the order of all characters in the original string have been reversed. |
right() | Returns a string containing the specified number of rightmost characters of the original string. |
rTrim() | Returns the original string with trailing white space removed. |
split() | Returns a list of strings resulting from the splitting of the original string around matches of the given delimiter. The split() function is not supported in the current release. |
substring() | Returns a substring of the original string, beginning with a zero-based index start and length. |
toLower() | Returns the original string in lowercase. |
toString() | Converts an integer, float, or boolean value to a string. |
toUpper() | Returns the original string in uppercase. |
trim() | Returns the original string with leading and trailing white space removed. |
User-defined Functions (Not Supported)
Comments (Supported)
Comments may be added to queries. Single line or inline comments begin with //, and multi- line comments are delimited by /* and */. For example:
MATCH (n) RETURN n // This is an end of line comment.