openCypher in GSQL

openCypher is a popular open-source declarative query language for property graphs. More about openCypher can be found at openCypher.org.

TigerGraph supports the majority of openCypher features, embedded within its native GSQL language. This page lists the features currently supported and features not yet supported .

It also describes how the different schema models in OpenCypher vs. GSQL affect some queries.

From version 4.1.2, certain restrictions on the MATCH and WITH clauses have been eliminated. Support was also added for UNION, UNION ALL, UNWIND, and collect(). Additionally, CREATE, REMOVE, SET, startNode(), and endNode() became partially supported.

openCypher Features in GSQL

Clauses

Clause Description

CREATE

Writing create nodes and relationships. Partially supported. See the note below for limitations.

DELETE

Delete graph elements — nodes and relationships.

Any node to be deleted must also have all associated relationships explicitly deleted.

DETACH DELETE

Writing Delete a node or set of nodes.

All associated relationships will automatically be deleted.

LIMIT

Reading sub-clause A sub-clause used to constrain the number of records in the output.

MATCH

Reading Specify the patterns to search for in the database.

See below for restrictions before version 4.1.2.

MANDATORY MATCH

Reading Specify the patterns to search for in the database, and fail if no match is found.

ORDER BY [ASC[ENDING] DESC[ENDING]]

Reading sub-clause A sub-clause following

RETURN or WITH

Specifying that the output should be sorted in either ascending (the default) or descending order.

REMOVE

Writing Remove properties and labels from nodes and relationships. Partially supported. See the note below for limitations.

RETURN … [AS]

Projecting Defines what to include in the query result set.

SET

Writing Update labels on nodes and properties on nodes and relationships. Partially supported. See the note below for limitations.

SKIP

Reading/Writing A sub-clause defining from which record to start including the records in the output.

UNION

Set operations Combines the result of multiple queries. Duplicates are removed.

UNION ALL

Set operations Combines the result of multiple queries. Duplicates are retained.

UNWIND … [AS]

Projecting Expands a list into a sequence of records.

WITH … [AS]

Projecting Allows query parts to be chained together, piping the results from one to be used as starting points or criteria in the next.

See below for restrictions before version 4.1.2.

WHERE

Reading sub-clause A sub-clause used to add constraints to the patterns in a MATCH clause, or to filter the results of a WITH clause.

Operators

% Mathematical Modulo division

*

Mathematical Multiplication

+

Mathematical Addition

+

String Concatenation

+

List Concatenation

-

Mathematical Subtraction or unary minus

.

General Property access

/

Mathematical Division

<

Comparison Less than

< =

Comparison Less than or equal to

<>

Comparison Inequality

=

Comparison Equality

>

Comparison Greater than

>=

Comparison Greater than or equal to

AND

Boolean Conjunction

CONTAINS

String comparison Case-sensitive inclusion search

DISTINCT

General Duplicate removal

ENDS WITH

String comparison Case-sensitive suffix search

IN List

List element existence check

IS NOT NULL

Comparison Non-null check

IS NULL

Comparison null check

NOT

Boolean Negation

OR

Boolean Disjunction

STARTS WITH

String comparison Case-sensitive prefix search

XOR

Boolean Exclusive disjunction

[ ]

General Subscript (dynamic property access)

[ ]

List Subscript (accessing element(s) in a list)

^

Mathematical Exponentiation

Functions

abs() Numeric Returns the absolute value of a number.

acos()

Trigonometric Returns the arccosine of a number in radians.

asin()

Trigonometric Returns the arcsine of a number in radians.

atan()

Trigonometric Returns the arctangent of a number in radians.

atan2()

Trigonometric Returns the arctangent2 of a set of coordinates in radians.

avg()

Aggregating Returns the average of a set of numeric values.

ceil()

Numeric Returns the smallest floating point number that is greater than or equal to a number and equal to a mathematical integer.

cos()

Trigonometric Returns the cosine of a number.

cot()

Trigonometric Returns the cotangent of a number.

count()

Aggregating Returns the number of values or records.

degrees()

Trigonometric Converts radians to degrees.

collect()

Returns a list containing the values returned by an expression.

e()

Logarithmic Returns the base of the natural logarithm, e.

elementId()

Scalar Returns the String id of a relationship or node.

endNode()

Returns the end node of a relationship. Partially supported. See the note below for limitations.

exp()

Logarithmic Returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.

floor()

Numeric Returns the largest floating point number that is less than or equal to a number and equal to a mathematical integer.

head()

Scalar Returns the first element in a list.

id()

Scalar Returns the id of a relationship or node.

last()

Scalar Returns the last element in a list.

left()

String Returns a string containing the specified number of leftmost characters of the original string.

log()

Logarithmic Returns the natural logarithm of a number.

log10()

Logarithmic Returns the common logarithm (base 10) of a number.

lTrim()

String Returns the original string with leading whitespace removed.

max()

Aggregating Returns the maximum value in a set of values.

min()

Aggregating Returns the minimum value in a set of values.

pi()

Trigonometric Returns the mathematical constant pi.

radians()

Trigonometric Converts degrees to radians.

rand()

Numeric Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e. [0, 1).

range()

List Returns a list comprising all integer values within a specified range.

replace()

String Returns a string in which all occurrences of a specified string in the original string have been replaced by another (specified) string.

reverse()

String Returns a string in which the order of all characters in the original string have been reversed.

right()

String Returns a string containing the specified number of rightmost characters of the original string.

round()

Numeric Returns the value of a number rounded to the nearest integer.

rTrim()

String Returns the original string with trailing whitespace removed.

sign()

Numeric Returns the signum of a number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number.

sin()

Trigonometric Returns the sine of a number.

size()

Scalar Returns the number of items in a list. (When applied to a list)

split()

String Returns a list of strings resulting from the splitting of the original string around matches of the given delimiter.

sqrt()

Logarithmic Returns the square root of a number.

startNode()

Returns the start node of a relationship. Partially supported. See the note below for limitations.

stDev()

Aggregating Returns the standard deviation for the given value over a group for a sample of a population.

stDevP()

Aggregating Returns the standard deviation for the given value over a group for an entire population

substring()

String Returns a substring of the original string, beginning with a 0-based index start and length.

sum()

Aggregating Returns the sum of a set of numeric values.

tail()

List Returns all but the first element in a list.

tan()

Trigonometric Returns the tangent of a number.

timestamp()

Scalar Returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

toLower()

String Returns the original string in lowercase.

toString()

String Converts an integer, float or boolean value to a string.

toUpper()

String Returns the original string in uppercase.

trim()

String Returns the original string with leading and trailing whitespace removed.

toBoolean()

Scalar Converts a string value to a boolean value.

toFloat()

Scalar Converts an integer or string value to a floating point number.

toInteger()

Scalar Converts a floating point or string value to an integer value.

CREATE, REMOVE, SET, startNode(), and endNode() are partially supported. These features are supported only in single-block queries and are not supported in queries that involve tables.

All openCypher functions listed above can be used in GSQL mode, and all primitive GSQL functions can be used in OpenCypher mode.

Expressions

CASE Expression

A generic conditional expression, similar to if/else statements available in other languages.

OpenCypher vs. GSQL Schema Models

GSQL, the language and storage engine, is strongly typed and schema-first:

  • Every vertex and edge belongs to a previously defined type.

  • Each type had a characteristics set of properties (attributes); there are no optional properties.

OpenCypher is schema-optional:

  • A vertex or edge may have a label.

  • A label may be associated with characteristic set of properties.

  • An individual vertex or edge could have additional properties.

This fundamental difference impacts how OpenCypher queries behave in each system.

Example

Consider the following OpenCypher query:

MATCH (p)
RETURN p.firstName, p.year

How GSQL OpenCypher mode Interprets This Query

Since GSQL OpenCypher enforces a predefined schema, the query:

  • Only considers vertex types that contain both firstName and year attributes

  • Returns values only if both attributes exist in a given vertex type

If a vertex type does not have both attributes, it is ignored entirely.

How OpenCypher Interprets This Query

OpenCypher does not enforce a schema, so the query:

  • Processes all vertex types, regardless of their attributes

  • Returns values for existing attributes but returns NULL for attributes that do not exist

Key Considerations

For users migrating from OpenCypher to GSQL OpenCypher, it is important to understand that:

  • In GSQL, queries must align with the predefined schema.

  • Unlike OpenCypher, GSQL does not return NULL for missing attributes: if a vertex does not contain all required attributes, it is not included in the result.

  • A query attempting to access a non-existent attribute in GSQL may either return no results or be rejected if no matching vertex type exists.

By understanding this distinction, users can write more effective OpenCypher queries tailored to GSQL OpenCypher’s schema-first approach.