Cypher Support

This document outlines the current capabilities of GIE in supporting Neo4j’s Cypher queries and compares them to the syntax specified in Neo4j. While our goal is to comply with Neo4j’s syntax, GIE currently has some limitations. One major constraint is that we solely support the read path in Cypher. Therefore, functionalities associated with writing, such as adding vertices/edges or modifying their properties, remain unaddressed.

We provide in-depth details regarding Cypher’s support in GIE, mainly including data types, operators and clauses. We further highlight planned features that we intend to offer in the near future. While all terminologies, including data types, operators, and keywords in clauses, are case-insensitive in this document, we use capital and lowercase letters for the terminologies of Neo4j and GIE, respectively, to ensure clarity.

Data Types

As Neo4j, we have provided support for data value of types in the categories of property, structural and constructed. However, the specific data types that we support are slightly modified from those in Cypher to ensure compatibility with our storage system. Further details will be elaborated upon.

Property Types

The available data types stored in the vertices (equivalent of nodes in Cypher) and edges (equivalent of relationships in Cypher), known as property types, are divided into several categories including Boolean, Integer, Float, String, Bytes, Placeholder and Temporal. These property types are extensively utilized and can be commonly utilized in queries and as parameters – making them the most commonly used data types.

Category

Cypher Type

GIE Type

Supported

Todo

Boolean

BOOLEAN

bool

Integer

INTEGER

int32/uint32/int64/uint64

Float

FLOAT

float/double

String

STRING

string

Bytes

BYTE_ARRAY

bytes

Placeholder

NULL

none

Planned

Temporal

DATE

date

Planned

Temporal

DATETIME (ZONED)

datetime (Zoned)

Planned

Temporal

TIME (ZONED)

time (Zoned)

Planned

Structural types

In a graph, Structural Types are the first-class citizens and are comprised of the following:

  • Vertex: It encodes the information of a particular vertex in the graph. The information includes the id, label, and a map of properties. However, it is essential to note that multiple labels in a vertex are currently unsupported in GIE.

  • Edge: It encodes the information of a particular edge in the graph. The information comprises the id, edge label, a map of properties, and a pair of vertex ids that refer to source/destination vertices.

  • Path: It encodes the alternating sequence of vertices and conceivably edges while traversing the graph.

Category

Cypher Type

GIE Type

Supported

Todo

Graph

NODE

vertex

Graph

RELATIONSHIP

edge

Graph

PATH

path

Constructed Types

Constructed types mainly include the categories of Array and Map.

Category

Cypher Type

GIE Type

Supported

Todo

Array

LIST<INNER_TYPE>

int32/int64/double/string/pair Array

Map

MAP

N/A

only used in Vertex/Edge

Operators

We list GIE’s support of the operators in the categories of Aggregation, Property, Mathematical, Comparison, String and Boolean. Examples and functionalities of these operators are the same as in Neo4j. Note that some Aggregator operators, such as max(), we listed here are implemented in Neo4j as functions. We have not introduced functions at this moment.

Category

Description

Cypher Operation

GIE Operation

Supported

Todo

Aggregate

Average value

AVG()

avg()

Aggregate

Minimum value

MIN()

min()

Aggregate

Maximum value

MAX()

max()

Aggregate

Count the elements

COUNT()

count()

Aggregate

Count the distinct elements

COUNT(DISTINCT)

count(distinct)

Aggregate

Summarize the value

SUM()

sum()

Aggregate

Collect into a list

COLLECT()

collect()

Aggregate

Collect into a set

COLLECT(DISTINCT)

collect(distinct)

Property

Get property of a vertex/edge

[N|R].“KEY”

[v|e].“key”

Mathematical

Addition

+

+

Mathematical

Subtraction

-

-

Mathematical

Multiplication

*

*

Mathematical

Division

/

/

Mathematical

Modulo division

%

%

Mathematical

Exponentiation

^

power(a, b)

Temporal Mathematical

Add a duration to a temporal type

<temporal> + <duration>

<temporal> + <duration>

Temporal Mathematical

Subtract a duration from a temporal type

<temporal> - <duration>

<temporal> - <duration>

Temporal Mathematical

Subtract two temporal types, returning a duration in milliseconds

<temporal> - <temporal>

<temporal> - <temporal>

Temporal Mathematical

Add two durations

<duration> + <duration>

<duration> + <duration>

Temporal Mathematical

Subtract two durations

<duration> - <duration>

<duration> - <duration>

Temporal Mathematical

Multiply a duration by a numeric value

<duration> * <numeric>

<duration> * <numeric>

Temporal Mathematical

Divide a duration by a numeric value

<duration> / <numeric>

<duration> / <numeric>

Comparison

Equality

=

=

Comparison

Inequality

<>

<>

Comparison

Less than

<

<

Comparison

Less than or equal

<=

<=

Comparison

Greater than

>

>

Comparison

Greater than or equal

>=

>=

Comparison

Verify as NULL

IS NULL

is null

Comparison

Verify as NOT NULL

IS NOT NULL

is not null

Comparison

Perform case-sensitive matching on the beginning of a string

STARTS WITH

starts with

Comparison

Perform case-sensitive matching on the ending of a string

ENDS WITH

ends with

Comparison

Perform case-sensitive matching regardless of location within a string

CONTAINS

contains

Boolean

Conjunction

AND

and

Boolean

Disjunction

OR

or

Boolean

Exclusive Disjunction

XOR

xor

planned

Boolean

Negation

NOT

not

BitOpr

Bit and

via function

&

BitOpr

Bit or

via function

|

Boolean

Bit xor

via function

^

BitOpr

Bit reverse

via function

~

planned

BitOpr

Bit left shift

via function

<<

BitOpr

Bit right shift

via function

>>

Branch

Use with Project and Return

CASE WHEN

CASE WHEN

planned

Scalar

Returns the length of a path

length()

length()

ListLiteral

Fold expressions into a single list

[]

[]

MapLiteral

Fold expressions with keys into a single map

{}

{}

Labels

Get label name of a vertex type

labels()

labels()

elementId

Get a vertex or an edge identifier, unique by an object type and a database

elementId()

elementId()

Type

Get label name of an edge type

type()

type()

Extract

Get interval value from a temporal type

<temporal>.<interval>

<temporal>.<interval>

Clause

A notable limitation for now is that we do not allow specifying multiple MATCH clauses in one query. For example, the following code will not compile:

MATCH (a) -[]-> (b)
WITH a, b
MATCH (a) -[]-> () -[]-> (b)  # second MATCH clause
RETURN a, b;

Keyword

Comments

Supported

Todo

MATCH

only one Match clause is allowed

OPTIONAL MATCH

implements as left outer join

RETURN … [AS]

WITH … [AS]

project, aggregate, distinct

WHERE

WHERE NOT EXIST (an edge/path)

implements as anti join

ORDER BY

LIMIT