Additional Cypher features

While the GQL Standard incorporates a lot of capabilities in Cypher®, Cypher contains additional features that are not part of GQL and no GQL alternatives currently exist for them. This page covers those Cypher features.

Clauses

Cypher feature Description

Import data from CSV files.

Ensures that a pattern exists in the graph. Either the pattern already exists, or it needs to be created.

Subqueries

Cypher feature Description

CALL subqueries executed in separate, inner transactions, producing intermediate commits.

Used to create a list with the rows returned by a subquery.

Used to count the number of rows returned by a subquery.

Used to discover if a specified pattern exists at least once in the graph

Values and types

Cypher feature Description

Spatial values.

Map values - the GQL equivalent is Records.

Comprehensions and projections

Cypher feature Description

Syntactic construct for creating a LIST based on existing lists.

Constructs MAP projections from nodes, relationships, and other MAP values.

Syntactic construct for creating a LIST based on matchings of a pattern.

Functions

Database functions

Cypher feature Description

Resolves the database name for the given element id.

GenAI functions

Cypher feature Description

Generates a vector embedding for a single value.

Graph functions

Cypher feature Description

Returns the graph reference with the given element id. It is only supported in the USE clause, on composite databases.

Returns the graph reference of the given name. It is only supported in the USE clause, on composite databases.

Lists the names of graphs in the current database.

Returns the MAP of properties associated with a graph.

List functions

Cypher feature Description

Returns a LIST<STRING> containing the STRING representations for all the property names of a NODE, RELATIONSHIP, or MAP.

Returns a LIST<STRING> containing the STRING representations for all the labels of a NODE.

Returns a LIST<NODE> containing all the NODE values in a PATH.

Returns a LIST<INTEGER> comprising all INTEGER values within a specified range.

Runs an expression against individual elements of a LIST<ANY>, storing the result of the expression in an accumulator.

Returns a LIST<RELATIONSHIP> containing all the RELATIONSHIP values in a PATH.

Returns a STRING or LIST<ANY> in which the order of all characters or elements in the given STRING or LIST<ANY> have been reversed.

Returns all but the first element in a LIST<ANY>.

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.

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.

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.

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.

LOAD CSV functions

Cypher feature Description

Returns the absolute path of the file that LOAD CSV is using.

Returns the line number that LOAD CSV is currently using.

Logarithmic functions

Cypher feature Description

e()

Returns the base of the natural logarithm, e.

Numeric functions

Cypher feature Description

Returns whether the given INTEGER or FLOAT is NaN.

Returns a random FLOAT in the range from 0 (inclusive) to 1 (exclusive).

Returns the value of a number rounded to the nearest 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.

Predicate functions

Cypher feature Description

Returns true if the predicate holds for all elements in the given LIST<ANY>.

Returns true if the predicate holds for at least one element in the given LIST<ANY>.

Checks whether a STRING, MAP, or LIST<ANY> is empty.

Returns true if the predicate holds for no element in the given LIST<ANY>.

Returns true if the predicate holds for exactly one of the elements in the given LIST<ANY>.

Scalar functions

Cypher feature Description

Returns the end NODE of a RELATIONSHIP.

Returns the first element in a LIST<ANY>.

Returns the last element in a LIST<ANY>.

Returns a MAP containing all the properties of a NODE, RELATIONSHIP, or MAP.

Generates a random UUID.

Returns the start NODE of a RELATIONSHIP.

Returns a STRING representation of the RELATIONSHIP type.

Returns a STRING representation of the most precise value type that the given expression evaluates to.

Spatial functions

Cypher feature Description

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.

Returns a FLOAT representing the geodesic distance between any two points in the same CRS.

Returns true if the provided point is within the bounding box defined by the two provided points.

String functions

Cypher feature Description

Returns a STRING in which all occurrences of a specified search STRING in the given STRING have been replaced by another (specified) replacement STRING.

Returns a STRING or LIST<ANY> in which the order of all characters or elements in the given STRING or LIST<ANY> have been reversed.

Returns a LIST<STRING> resulting from the splitting of the given STRING around matches of the given delimiter(s).

Returns a substring of the given STRING, beginning with a 0-based index start.

Trigonometric functions

Cypher feature Description

Returns the arctangent2 of a set of coordinates in radians.

Returns half the versine of a number.

Returns the mathematical constant pi.

Temporal duration functions

Cypher feature Description

Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in days.

Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in months.

Computes the DURATION between the from instant (inclusive) and the to instant (exclusive) in seconds.

Temporal instant functions

Cypher feature Description

Returns the current DATE instant using the realtime clock.

Returns the current DATE instant using the statement clock.

Returns the current DATE instant using the transaction clock.

Returns the current DATE instant using the transaction clock.

Creates a ZONED DATETIME given the seconds and nanoseconds since the start of the epoch.

Creates a ZONED DATETIME given the milliseconds since the start of the epoch.

Returns the current ZONED DATETIME instant using the realtime clock.

Returns the current ZONED DATETIME instant using the statement clock.

Returns the current ZONED DATETIME instant using the transaction clock.

Truncates the given temporal value to a ZONED DATETIME instant using the specified unit.

Returns the current LOCAL DATETIME instant using the realtime clock.

Returns the current LOCAL DATETIME instant using the statement clock.

Returns the current LOCAL DATETIME instant using the transaction clock.

Truncates the given temporal value to a LOCAL DATETIME instant using the specified unit.

Returns the current LOCAL TIME instant using the realtime clock.

Returns the current LOCAL TIME instant using the statement clock.

Returns the current LOCAL TIME instant using the transaction clock.

Truncates the given temporal value to a LOCAL TIME instant using the specified unit.

Returns the current ZONED TIME instant using the realtime clock.

Returns the current ZONED TIME instant using the statement clock.

Returns the current ZONED TIME instant using the transaction clock.

Truncates the given temporal value to a ZONED TIME instant using the specified unit.

Vector functions

Cypher feature Description

Returns a FLOAT representing the similarity between the argument vectors based on their cosine.

Returns a FLOAT representing the similarity between the argument vectors based on their Euclidean distance.

Indexes

Cypher feature Description

Neo4j’s default index. Supports most types of predicates.

Solves predicates operating on STRING values. Optimized for queries filtering with the STRING operators CONTAINS and ENDS WITH.

Solves predicates on spatial POINT values. Optimized for queries filtering on distance or within bounding boxes.

Only solves node label and relationship type predicates (i.e. they cannot solve any predicates filtering on properties).

Enables searching within the content of STRING properties and for similarity comparisons between query strings and STRING values stored in the database.

Enables similarity searches and complex analytical queries by representing nodes or properties as vectors in a multidimensional space.

Cypher allows for index hints to influence the planner when creating execution plans. Index hints are specified with the USING keyword.

Constraints

GQL supports GRAPH TYPES as a way of constraining a graph schema, but does not support individual constraints.

Cypher feature Description

Ensures that certain nodes have a set of specified properties whose combined value is unique when all properties exist on the node

Ensures that certain relationships have a set of specified properties whose combined value is unique when all properties exist on the relationship.

Ensures that certain nodes have a specified property.

Ensures that certain relationships have a specified property.

Ensures that certain nodes have a property of the required property type when the property exists on the node.

Ensures that certain relationships have a property of the required property type when the property exists on the relationship.

Ensures that certain nodes have a set of specified properties whose combined value is unique and all properties in the set are present.

Ensures that certain relationships have a set of defined properties whose combined value is unique. It also ensures that all properties in the set are present.

Operators

Cypher feature Description

STRING comparison operators.

IN

IN predicate for LIST values.

Query optimization

Cypher feature Description

Optionally prepended to queries to produce execution plans. EXPLAIN will only generate an execution plan but not run the query; PROFILE will do both.

CYPHER runtime=parallel

Cypher allows for setting the runtime of queries, determining how the query will be executed. The available Cypher runtimes are: slotted, pipelined, parallel.

CYPHER inferSchemaParts=off

Cypher allows for setting numerous query options. For more information, see Query options.

Administration

The documentation for Cypher’s administration commands is located in Neo4j’s Operation Manual.
Cypher feature Description

Commands to CREATE, SHOW, ALTER, and DROP standard and composite databases.

Commands to CREATE, SHOW, ALTER, and DROP database aliases.

Commands to administer servers in a cluster and the databases allocated to them.

Commands to manage users, roles, and privileges.