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.
Subqueries
Cypher feature | Description |
---|---|
|
|
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 |
|
Constructs |
|
Syntactic construct for creating a |
Dynamic queries
Node labels, relationship types, properties, and CSV columns can be referenced dynamically using Cypher. This allows for more flexible queries and mitigates the risk of Cypher injection. (For more information about Cypher injection, see Neo4j Knowledge Base → Protecting against Cypher injection).
Cypher feature | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Functions
Graph functions
Cypher feature | Description |
---|---|
Returns the graph reference with the given element id.
It is only supported in the |
|
Returns the graph reference of the given name. It is only supported in the |
|
Lists the names of graphs in the current database. |
|
Returns the |
List functions
Cypher feature | Description |
---|---|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Runs an expression against individual elements of a |
|
Returns a |
|
Returns a |
|
Returns all but the first element in a |
|
Converts a |
|
Converts a |
|
Converts a |
|
Converts an |
LOAD CSV functions
Cypher feature | Description |
---|---|
Returns the absolute path of the file that |
|
Returns the line number that |
Numeric functions
Cypher feature | Description |
---|---|
Returns whether the given |
|
Returns a random |
|
Returns the value of a number rounded to the nearest |
|
Returns the signum of an |
Predicate functions
Cypher feature | Description |
---|---|
Returns true if the predicate holds for all elements in the given |
|
Returns true if the predicate holds for at least one element in the given |
|
Checks whether a |
|
Returns true if the predicate holds for no element in the given |
|
Returns true if the predicate holds for exactly one of the elements in the given |
Scalar functions
Cypher feature | Description |
---|---|
Returns the end |
|
Returns the first element in a |
|
Returns the last element in a |
|
Returns a |
|
Generates a random UUID. |
|
Returns the start |
|
Returns a |
|
Returns a |
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 |
|
Returns true if the provided point is within the bounding box defined by the two provided points. |
String functions
Cypher feature | Description |
---|---|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a substring of the given |
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 |
|
Computes the |
|
Computes the |
Temporal instant functions
Cypher feature | Description |
---|---|
Returns the current |
|
Returns the current |
|
Returns the current |
|
Returns the current |
|
Creates a |
|
Creates a |
|
Returns the current |
|
Returns the current |
|
Returns the current |
|
Truncates the given temporal value to a |
|
Returns the current |
|
Returns the current |
|
Returns the current |
|
Truncates the given temporal value to a |
|
Returns the current |
|
Returns the current |
|
Returns the current |
|
Truncates the given temporal value to a |
|
Returns the current |
|
Returns the current |
|
Returns the current |
|
Truncates the given temporal value to a |
Indexes
Cypher feature | Description |
---|---|
Neo4j’s default index. Supports most types of predicates. |
|
Solves predicates operating on |
|
Solves predicates on spatial |
|
Only solves node label and relationship type predicates (i.e. they cannot solve any predicates filtering on properties). |
|
Enables searching within the content of |
|
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 |
Constraints
GQL supports GRAPH TYPES
as a way of constraining a graph schema, but does not support individual constraints.
Cypher feature | Description |
---|---|
Ensures that the combined property values are unique for all nodes with a specific label or all relationships with a specific type. |
|
Ensures that a property exists either for all nodes with a specific label or for all relationships with a specific type. |
|
Ensures that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. |
|
Ensures that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type. |
Query optimization
Cypher feature | Description |
---|---|
Optionally prepended to queries to produce execution plans.
|
|
|
Cypher allows for setting the runtime of queries, determining how the query will be executed. The available Cypher runtimes are: slotted, pipelined, parallel. |
|
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 |
|
Commands to |
|
Commands to administer servers in a cluster and the databases allocated to them. |
|
Commands to manage users, roles, and privileges. |