Functions
| Function | Signature | Description |
|
avg()
|
avg(input :: INTEGER | FLOAT | DURATION) :: INTEGER | FLOAT | DURATION
|
Returns the average of a set of INTEGER, FLOAT, or DURATION values.
|
|
collect()
|
collect(input :: ANY) :: LIST<ANY>
|
Returns a list containing the values returned by an expression.
|
|
count()
|
count(input :: ANY) :: INTEGER
|
Returns the number of values or rows.
|
|
max()
|
max(input :: ANY) :: ANY
|
Returns the maximum value in a set of values.
|
|
min()
|
min(input :: ANY) :: ANY
|
Returns the minimum value in a set of values.
|
|
percentileCont()
|
percentileCont(input :: FLOAT, percentile :: FLOAT) :: FLOAT
|
Returns the percentile of a value over a group using linear interpolation.
|
|
percentileDisc()
|
percentileDisc(input :: INTEGER | FLOAT, percentile :: FLOAT) :: FLOAT
|
Returns the nearest INTEGER or FLOAT value to the given percentile over a group using a rounding method.
|
|
stDev()
|
stDev(input :: FLOAT) :: FLOAT
|
Returns the standard deviation for the given value over a group for a sample of a population.
|
|
stDevP()
|
stDevP(input :: FLOAT) :: FLOAT
|
Returns the standard deviation for the given value over a group for an entire population.
|
|
sum()
|
sum(input :: INTEGER | FLOAT | DURATION) :: INTEGER | FLOAT | DURATION
|
Returns the sum of a set of INTEGER, FLOAT, or DURATION values.
|
| Function | Signature | Description |
|
db.nameFromElementId()
|
db.nameFromElementId(elementId :: STRING) :: STRING
|
Resolves the database name from the given element id.
|
| Function | Signature | Description |
|
genai.vector.encode()
|
genai.vector.encode(resource :: STRING, provider :: STRING, configuration :: MAP = {}) :: LIST<FLOAT>
|
Encode a given resource as a vector using the named provider.
|
Graph functions provide information about the constituent graphs in composite databases.
| Function | Signature | Description |
|
graph.byElementId()
|
USE graph.byElementId(elementId :: STRING)
|
Resolves the constituent graph to which a given element id belongs. Introduced in 5.13
|
|
graph.byName()
|
USE graph.byName(name :: STRING)
|
Resolves a constituent graph by name.
|
|
graph.names()
|
graph.names() :: LIST<STRING>
|
Returns a list containing the names of all graphs in the current composite database.
|
|
graph.propertiesByName()
|
graph.propertiesByName(name :: STRING) :: MAP
|
Returns a map containing the properties associated with the given graph.
|
| Function | Signature | Description |
|
keys()
|
keys(input :: NODE | RELATIONSHIP | MAP) :: LIST<STRING>
|
Returns a LIST<STRING> containing the STRING representations for all the property names of a MAP, NODE, or RELATIONSHIP.
|
|
labels()
|
labels(input :: NODE) :: LIST<STRING>
|
Returns a LIST<STRING> containing the STRING representations for all the labels of a NODE.
|
|
nodes()
|
nodes(input :: PATH) :: LIST<NODE>
|
Returns a LIST<NODE> containing all the NODE values in a PATH.
|
|
range()
|
range(start :: INTEGER, end :: INTEGER [, step :: INTEGER]) :: LIST<INTEGER>
|
Returns a LIST<INTEGER> comprising all INTEGER values within a specified range, optionally specifying a step length.
|
|
reduce()
|
reduce(accumulator :: VARIABLE = initial :: ANY, variable :: VARIABLE IN list :: LIST<ANY> expression :: ANY) :: ANY
|
Runs an expression against individual elements of a LIST<ANY>, storing the result of the expression in an accumulator.
|
|
relationships()
|
relationships(input :: PATH) :: LIST<RELATIONSHIP>
|
Returns a LIST<RELATIONSHIP> containing all the RELATIONSHIP values in a PATH.
|
|
reverse()
|
reverse(input :: LIST<ANY>) :: LIST<ANY>
|
Returns a LIST<ANY> in which the order of all elements in the given LIST<ANY> have been reversed.
|
|
tail()
|
tail(input :: LIST<ANY>) :: LIST<ANY>
|
Returns all but the first element in a LIST<ANY>.
|
|
toBooleanList()
|
toBooleanList(input :: LIST<ANY>) :: LIST<BOOLEAN>
|
Converts a LIST<ANY> of values to a LIST<BOOLEAN> values. If any values are not convertible to BOOLEAN they will be null in the LIST<BOOLEAN> returned.
|
|
toFloatList()
|
toFloatList(input :: LIST<ANY>) :: LIST<FLOAT>
|
Converts a LIST<ANY> to a LIST<FLOAT> values. If any values are not convertible to FLOAT they will be null in the LIST<FLOAT> returned.
|
|
toIntegerList()
|
toIntegerList(input :: LIST<ANY>) :: LIST<INTEGER>
|
Converts a LIST<ANY> to a LIST<INTEGER> values. If any values are not convertible to INTEGER they will be null in the LIST<INTEGER> returned.
|
|
toStringList()
|
toStringList(input :: LIST<ANY>) :: LIST<STRING>
|
Converts a LIST<ANY> to a LIST<STRING> values. If any values are not convertible to STRING they will be null in the LIST<STRING> returned.
|
LOAD CSV functions can be used to get information about the file that is processed by LOAD CSV.
| Function | Signature | Description |
|
file()
|
file() :: STRING
|
Returns the absolute path of the file that LOAD CSV is using.
|
|
linenumber()
|
linenumber() :: INTEGER
|
Returns the line number that LOAD CSV is currently using.
|
These functions all operate on numerical expressions only, and will return an error if used on any other values.
| Function | Signature | Description |
|
e()
|
e() :: FLOAT
|
Returns the base of the natural logarithm, e.
|
|
exp()
|
exp(input :: FLOAT) :: FLOAT
|
Returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.
|
|
log()
|
log(input :: FLOAT) :: FLOAT
|
Returns the natural logarithm of a FLOAT.
|
|
log10()
|
log10(input :: FLOAT) :: FLOAT
|
Returns the common logarithm (base 10) of a FLOAT.
|
|
sqrt()
|
sqrt(input :: FLOAT) :: FLOAT
|
Returns the square root of a FLOAT.
|
These functions all operate on numerical expressions only, and will return an error if used on any other values.
| Function | Signature | Description |
|
abs()
|
abs(input :: INTEGER | FLOAT) :: INTEGER | FLOAT
|
Returns the absolute value of an INTEGER or FLOAT.
|
|
ceil()
|
ceil(input :: FLOAT) :: FLOAT
|
Returns the smallest FLOAT that is greater than or equal to a number and equal to an INTEGER.
|
|
floor()
|
floor(input :: FLOAT) :: FLOAT
|
Returns the largest FLOAT that is less than or equal to a number and equal to an INTEGER.
|
|
isNaN()
|
isNaN(input :: INTEGER | FLOAT) :: BOOLEAN
|
Returns true if the floating point number is NaN.
|
|
rand()
|
rand() :: FLOAT
|
Returns a random FLOAT in the range from 0 (inclusive) to 1 (exclusive).
|
|
round()
|
round(input :: FLOAT [, precision :: INTEGER | FLOAT, mode :: STRING]) :: FLOAT
|
Returns the value of a number rounded to the nearest INTEGER, optionally using a specified precision and rounding mode.
|
|
sign()
|
sign(input :: INTEGER | FLOAT) :: INTEGER
|
Returns the signum of an INTEGER or FLOAT: 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.
All trigonometric functions operate on radians, unless otherwise specified.
| Function | Signature | Description |
|
acos()
|
acos(input :: FLOAT) :: FLOAT
|
Returns the arccosine of a FLOAT in radians.
|
|
asin()
|
asin(input :: FLOAT) :: FLOAT
|
Returns the arcsine of a FLOAT in radians.
|
|
atan()
|
atan(input :: FLOAT) :: FLOAT
|
Returns the arctangent of a FLOAT in radians.
|
|
atan2()
|
atan2(y :: FLOAT, x :: FLOAT) :: FLOAT
|
Returns the arctangent2 of a set of coordinates in radians.
|
|
cos()
|
cos(input :: FLOAT) :: FLOAT
|
Returns the cosine of a FLOAT.
|
|
cot()
|
cot(input :: FLOAT) :: FLOAT
|
Returns the cotangent of a FLOAT.
|
|
degrees()
|
degrees(input :: FLOAT) :: FLOAT
|
Converts radians to degrees.
|
|
haversin()
|
haversin(input :: FLOAT) :: FLOAT
|
Returns half the versine of a number.
|
|
pi()
|
pi() :: FLOAT
|
Returns the mathematical constant pi.
|
|
radians()
|
radians(input :: FLOAT) :: FLOAT
|
Converts degrees to radians.
|
|
sin()
|
sin(input :: FLOAT) :: FLOAT
|
Returns the sine of a FLOAT.
|
|
tan()
|
tan(input :: FLOAT) :: FLOAT
|
Returns the tangent of a FLOAT.
|
![]()
These functions return either true or false for the given arguments.
| Function | Signature | Description |
|
all()
|
all(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN
|
Returns true if the predicate holds for all elements in the given LIST<ANY>.
|
|
any()
|
any(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN
|
Returns true if the predicate holds for at least one element in the given LIST<ANY>.
|
|
exists()
|
exists(input :: ANY) :: BOOLEAN
|
Returns true if a match for the pattern exists in the graph.
|
|
isEmpty()
|
isEmpty(input :: LIST<ANY> | MAP | STRING ) :: BOOLEAN
|
Checks whether the given LIST<ANY>, MAP, or STRING is empty.
|
|
none()
|
none(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN
|
Returns true if the predicate holds for no element in the given LIST<ANY>.
|
|
single()
|
single(variable :: ANY, list :: LIST<ANY>, predicate :: ANY) :: BOOLEAN
|
Returns true if the predicate holds for exactly one of the elements in the given LIST<ANY>.
|
These functions return a single value.
| Function | Signature | Description |
|
char_length()
|
char_length(input :: STRING) :: INTEGER
|
Returns the number of Unicode characters in a STRING. Introduced in 5.13
|
|
character_length()
|
character_length(input :: STRING) :: INTEGER
|
Returns the number of Unicode characters in a STRING. Introduced in 5.13
|
|
coalesce()
|
coalesce(input :: ANY) :: ANY
|
Returns the first non-null value in a list of expressions.
|
|
elementId()
|
elementId(input :: NODE | RELATIONSHIP) :: STRING
|
Returns a node or relationship identifier, unique within a specific transaction and DBMS.
|
|
endNode()
|
endNode(input :: RELATIONSHIP) :: NODE
|
Returns the end NODE of a RELATIONSHIP.
|
|
head()
|
head(list :: LIST<ANY>) :: ANY
|
Returns the first element in a LIST<ANY>.
|
|
id()
|
id(input :: NODE | RELATIONSHIP) :: INTEGER
|
Deprecated Returns the id of a NODE or a RELATIONSHIP. Replaced by elementId().
|
|
last()
|
last(list :: LIST<ANY>) :: ANY
|
Returns the last element in a LIST<ANY>.
|
|
length()
|
length(input :: PATH) :: INTEGER
|
Returns the length of a PATH.
|
|
nullIf()
|
nullIf(v1 :: ANY, v2 :: ANY) :: ANY
|
Returns null if the two given parameters are equivalent, otherwise returns the value of the first parameter.
|
|
properties()
|
properties(input :: NODE | RELATIONSHIP | MAP) :: MAP
|
Returns a MAP containing all the properties of a NODE or RELATIONSHIP.
|
|
randomUUID()
|
randomUUID() :: STRING
|
Generates a random UUID.
|
|
size()
|
size(input STRING | LIST<ANY>) :: INTEGER
|
Returns the number of items in a LIST<ANY> or the number of Unicode characters in a STRING.
|
|
startNode()
|
startNode(input :: RELATIONSHIP) :: NODE
|
Returns the start NODE of a RELATIONSHIP.
|
|
toBoolean()
|
toBoolean(input :: BOOLEAN | STRING | INTEGER) :: BOOLEAN
|
Converts a BOOLEAN, STRING, or an INTEGER value to a BOOLEAN value.
|
|
toBooleanOrNull()
|
toBooleanOrNull(input :: ANY) :: BOOLEAN
|
Converts a value to a BOOLEAN value, or null if the value cannot be converted.
|
|
toFloat()
|
toFloat(input :: STRING | INTEGER | FLOAT) :: FLOAT
|
Converts a STRING or INTEGER value to a FLOAT value.
|
|
toFloatOrNull()
|
toFloatOrNull(input :: ANY) :: FLOAT
|
Converts a value to a FLOAT value, or null if the value cannot be converted.
|
|
toInteger()
|
toInteger(input :: BOOLEAN | STRING | INTEGER | FLOAT) :: INTEGER
|
Converts a BOOLEAN, `STRING, or FLOAT value to an INTEGER value.
|
|
toIntegerOrNull()
|
toIntegerOrNull(input :: ANY) :: INTEGER
|
Converts a value to an INTEGER value, or null if the value cannot be converted.
|
|
type()
|
type(input :: RELATIONSHIP) :: STRING
|
Returns a STRING representation of the RELATIONSHIP type.
|
|
valueType()
|
valueType(input :: ANY) :: STRING
|
Returns a STRING representation of the most precise value type that the given expression evaluates to.
|
These functions are used to manipulate STRING values or to create a STRING representation of another value.
| Function | Signature | Description |
|
btrim()
|
btrim(original :: STRING [, trimCharacterString :: STRING ]) :: STRING
|
Returns the given STRING with leading and trailing whitespace removed, optionally specifying a trimCharacterString value to remove. Introduced in 5.20
|
|
left()
|
left(original :: STRING, length :: INTEGER) :: STRING
|
Returns a STRING containing the specified number (INTEGER) of leftmost characters in the given STRING.
|
|
lower()
|
lower(input :: STRING) :: STRING
|
Returns the given STRING in lowercase. This function is an alias to the toLower() function, and it was introduced as part of Cypher’s GQL conformance. Introduced in 5.21
|
|
ltrim()
|
ltrim(input :: STRING [, trimCharacterString :: STRING]) :: STRING
|
Returns the given STRING with leading whitespace removed, optionally specifying a trimCharacterString to remove.
|
|
normalize()
|
normalize(input :: STRING [,normalForm = NFC :: [NFC, NFD, NFKC, NFKD]]) :: STRING
|
Normalizes a STRING, optionally specifying a normalization form. Introduced in 5.17
|
|
replace()
|
replace(original :: STRING, search :: STRING, replace :: STRING) :: STRING
|
Returns a STRING in which all occurrences of a specified search STRING in the given STRING have been replaced by another (specified) replacement STRING.
|
|
reverse()
|
reverse(input :: STRING) :: STRING
|
Returns a STRING in which the order of all characters in the given STRING have been reversed.
|
|
right()
|
right(original :: STRING, length :: INTEGER) :: STRING
|
Returns a STRING containing the specified number of rightmost characters in the given STRING.
|
|
rtrim()
|
rtrim(input :: STRING [, trimCharacterString :: STRING]) :: STRING
|
Returns the given STRING with trailing whitespace removed, optionally specifying a trimCharacterString of characters to remove.
|
|
split()
|
split(original :: STRING, splitDelimiters :: LIST<STRING>) :: LIST<STRING>
|
Returns a LIST<STRING> resulting from the splitting of the given STRING around matches of any of the given delimiters.
|
|
substring()
|
substring(original :: STRING, start :: INTEGER length :: INTEGER) :: STRING
|
Returns a substring of a given length from the given STRING, beginning with a 0-based index start.
|
|
toLower()
|
toLower(input :: STRING) :: STRING
|
Returns the given STRING in lowercase.
|
|
toString()
|
toString(input :: ANY) :: STRING
|
Converts an INTEGER, FLOAT, BOOLEAN, POINT or temporal type (i.e. DATE, ZONED TIME, LOCAL TIME, ZONED DATETIME, LOCAL DATETIME or DURATION) value to a STRING.
|
|
toStringOrNull()
|
toStringOrNull(input :: ANY) :: STRING
|
Converts an INTEGER, FLOAT, BOOLEAN, POINT or temporal type (i.e. DATE, ZONED TIME, LOCAL TIME, ZONED DATETIME, LOCAL DATETIME or DURATION) value to a STRING, or null if the value cannot be converted.
|
|
toUpper()
|
toUpper(input :: STRING) :: STRING
|
Returns the given STRING in uppercase.
|
|
trim()
|
trim(trimCharacterString :: STRING, trimSpecification :: STRING, input :: STRING) :: STRING
|
Returns the given STRING with the leading and/or trailing trimCharacterString character removed.
|
|
upper()
|
upper(input :: STRING) :: STRING
|
Returns the given STRING in uppercase. This function is an alias to the toUpper() function, and it was introduced as part of Cypher’s GQL conformance. Introduced in 5.21
|
String normalization is the process of converting text into a standard, consistent format to ensure uniformity and avoid discrepancies caused by different character representations. It is commonly used in text processing, search indexing, and data comparison.
Why Normalize Strings?
-
Unicode Variations: Some characters have multiple valid Unicode representations. For example, é can be:
- As a single character:
U+00E9 (é)
- As a combination of
e and an accent: U+0065 U+0301 (é)
-
Case Sensitivity: Normalizing strings can convert them to a consistent case (e.g., all lowercase or uppercase).
-
Whitespace & Special Characters: Normalization can remove unnecessary spaces, punctuation, or special characters.
Common Forms of Unicode Normalization (NFC, NFD, NFKC, NFKD)
Unicode normalization follows four standard forms:
- NFC (Normalization Form C): Composes characters into their canonical form.
- NFD (Normalization Form D): Decomposes characters into their base form and diacritical marks.
- NFKC (Compatibility Composition): Similar to NFC but also replaces compatibility characters.
- NFKD (Compatibility Decomposition): Similar to NFD but includes compatibility character replacements.
Example in Python
import unicodedata
text = "é"
print(unicodedata.normalize("NFD", text)) # Decomposed form: e + ́
print(unicodedata.normalize("NFC", text)) # Composed form: é
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 |
|
point()
|
point(input :: MAP) :: POINT
|
Returns a 2D or 3D point object, given two or respectively three coordinate values in the Cartesian coordinate system or WGS 84 geographic coordinate system.
|
|
point.distance()
|
point.distance(from :: POINT, to :: POINT) :: FLOAT
|
Returns a FLOAT representing the distance between any two points in the same CRS. If the points are in the WGS 84 CRS, the function returns the geodesic distance (i.e., the shortest path along the curved surface of the Earth). If the points are in a Cartesian CRS, the function returns the Euclidean distance (i.e., the shortest straight-line distance in a flat, planar space).
|
|
point.withinBBox()
|
point.withinBBox(point :: POINT, lowerLeft :: POINT, upperRight :: POINT) :: BOOLEAN
|
Returns true if the provided point is within the bounding box defined by the two provided points, lowerLeft and upperRight.
|
DURATION values of the temporal types can be created manipulated using the following functions:
| Function | Signature | Description |
|
duration()
|
duration(input :: ANY) :: DURATION
|
Constructs a DURATION value.
|
|
duration.between()
|
duration.between(from :: ANY, to :: ANY) :: DURATION
|
Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in logical units.
|
|
duration.inDays()
|
duration.inDays(from :: ANY, to :: ANY) :: DURATION
|
Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in days.
|
|
duration.inMonths()
|
duration.inMonths(from :: ANY, to :: ANY) :: DURATION
|
Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in months.
|
|
duration.inSeconds()
|
duration.inSeconds(from :: ANY, to :: ANY) :: DURATION
|
Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in seconds.
|
Values of the temporal types — DATE, ZONED TIME, LOCAL TIME, ZONED DATETIME, and LOCAL DATETIME — can be created manipulated using the following functions:
| Function | Signature | Description |
|
date()
|
date(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE
|
Creates a DATE instant.
|
|
date.realtime()
|
date.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE
|
Returns the current DATE instant using the realtime clock.
|
|
date.statement()
|
date.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE
|
Returns the current DATE instant using the statement clock.
|
|
date.transaction()
|
date.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: DATE
|
Returns the current DATE instant using the transaction clock.
|
|
date.truncate()
|
date.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: DATE
|
Truncates the given temporal value to a DATE instant using the specified unit.
|
|
datetime()
|
datetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME
|
Creates a ZONED DATETIME instant.
|
|
datetime.fromepoch()
|
datetime.fromepoch(seconds :: INTEGER | FLOAT, nanoseconds :: INTEGER | FLOAT) :: ZONED DATETIME
|
Creates a ZONED DATETIME given the seconds and nanoseconds since the start of the epoch.
|
|
datetime.fromepochmillis()
|
datetime.fromepochmillis(milliseconds :: INTEGER | FLOAT) :: ZONED DATETIME
|
Creates a ZONED DATETIME given the milliseconds since the start of the epoch.
|
|
datetime.realtime()
|
datetime.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME
|
Returns the current ZONED DATETIME instant using the realtime clock.
|
|
datetime.statement()
|
datetime.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME
|
Returns the current ZONED DATETIME instant using the statement clock.
|
|
datetime.transaction()
|
datetime.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED DATETIME
|
Returns the current ZONED DATETIME instant using the transaction clock.
|
|
datetime.truncate()
|
datetime.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: ZONED DATETIME
|
Truncates the given temporal value to a ZONED DATETIME instant using the specified unit.
|
|
localdatetime()
|
localdatetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME
|
Creates a LOCAL DATETIME instant.
|
|
localdatetime.realtime()
|
localdatetime.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME
|
Returns the current LOCAL DATETIME instant using the realtime clock.
|
|
localdatetime.statement()
|
localdatetime.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME
|
Returns the current LOCAL DATETIME instant using the statement clock.
|
|
localdatetime.transaction()
|
localdatetime.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL DATETIME
|
Returns the current LOCAL DATETIME instant using the transaction clock.
|
|
localdatetime.truncate()
|
localdatetime.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: LOCAL DATETIME
|
Truncates the given temporal value to a LOCAL DATETIME instant using the specified unit.
|
|
localtime()
|
localtime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME
|
Creates a LOCAL TIME instant.
|
|
localtime.realtime()
|
localtime.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME
|
Returns the current LOCAL TIME instant using the realtime clock.
|
|
localtime.statement()
|
localtime.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME
|
Returns the current LOCAL TIME instant using the statement clock.
|
|
localtime.transaction()
|
localtime.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: LOCAL TIME
|
Returns the current LOCAL TIME instant using the transaction clock.
|
|
localtime.truncate()
|
localtime.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: LOCAL TIME
|
Truncates the given temporal value to a LOCAL TIME instant using the specified unit.
|
|
time()
|
time(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME
|
Creates a ZONED TIME instant.
|
|
time.realtime()
|
time.realtime(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME
|
Returns the current ZONED TIME instant using the realtime clock.
|
|
time.statement()
|
time.statement(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME
|
Returns the current ZONED TIME instant using the statement clock.
|
|
time.transaction()
|
time.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY) :: ZONED TIME
|
Returns the current ZONED TIME instant using the transaction clock.
|
|
time.truncate()
|
time.truncate(unit :: STRING, input = DEFAULT_TEMPORAL_ARGUMENT :: ANY, fields = null :: MAP) :: ZONED TIME
|
Truncates the given temporal value to a ZONED TIME instant using the specified unit.
|
The realtime, statement, and transaction clocks refer to different ways of tracking time in a database system, particularly in the context of SQL and time-sensitive operations. Here’s what each clock represents:
1. Realtime Clock (date.realtime())
- The realtime clock represents the actual current date and time as observed by the system clock.
- It provides the precise wall-clock time at the moment the function is called.
- This clock is independent of database transactions or queries.
📌 Use Case:
- Logging events based on actual system time.
- Getting the exact current date at the moment of execution.
2. Statement Clock (date.statement())
- The statement clock represents the date at the start of the SQL statement execution.
- The value remains constant throughout the execution of the entire SQL statement.
- Even if the statement takes time to execute, the value does not change.
📌 Use Case:
- Ensuring consistency within a single statement.
- Avoiding time inconsistencies in queries that process multiple rows.
3. Transaction Clock (date.transaction())
- The transaction clock represents the date at the start of the current transaction.
- It remains constant for the entire transaction duration, even if multiple SQL statements are executed.
- Useful for ensuring all changes within a transaction use the same timestamp.
📌 Use Case:
- Maintaining a consistent timestamp across multiple queries in a transaction.
- Ensuring atomicity in time-sensitive database operations.
Comparison Table
| Clock Type | Value Changes? | Scope |
Realtime (date.realtime()) |
Yes |
Changes every time it's called (real-time system clock). |
Statement (date.statement()) |
No |
Constant during the execution of a single SQL statement. |
Transaction (date.transaction()) |
No |
Constant throughout the entire transaction. |
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:
Vector functions allow you to compute the similarity scores of vector pairs.
| Function | Signature | Description |
|
vector.similarity.cosine()
|
vector.similarity.cosine(a :: LIST<INTEGER | FLOAT>, b :: LIST<INTEGER | FLOAT>) :: FLOAT
|
Returns a FLOAT representing the similarity between the argument vectors based on their cosine.
|
|
vector.similarity.euclidean()
|
vector.similarity.euclidean(a :: LIST<INTEGER | FLOAT>, b :: LIST<INTEGER | FLOAT>) :: FLOAT
|
Returns a FLOAT representing the similarity between the argument vectors based on their Euclidean distance.
|
|