Skip to content


About openCypher compatibility

Is nGQL compatible with openCypher 9?

nGQL is partially compatible with openCypher 9. Known incompatible items are listed in Nebula Graph Issues. Submit an issue with the incompatible tag if you find a new issue of this type. You can search in this manual with the keyword compatibility to find major compatibility issues.

The following are some major differences (by design incompatible) between nGQL and openCypher.

openCypher 9 nGQL
schema optional strong schema
equality operator '=' equality operator '=='
math exponentiation ^ ^ not supported. Use pow(x, y) instead.
no such concept edge rank (reference by @)
all DMLs (CREATE, MERGE, etc), and OPTIONAL MATCH are not supported.

NOTE: openCypher 9 and Cypher have some differences (in grammar and licence). For example, Cypher requires that All Cypher statements are explicitly run within a transaction. While openCypher has no such requirement of transaction. And nGQL does not support transaction.

Where can I find more nGQL examples?

Find more than 2500 nGQL examples in the features directory on the Nebula Graph GitHub page.

The features directory consists of .feature files. Each file records scenarios that you can use as nGQL examples.

Here is an example:

Feature: Match seek by tag

  Background: Prepare space
    Given a graph with space named "basketballplayer"

  Scenario: seek by empty tag index
    When executing query:
      MATCH (v:bachelor)
      RETURN id(v) AS vid
    Then the result should be, in any order:
      | vid          |
      | 'Tim Duncan' |
    And no side effects
    When executing query:
      MATCH (v:bachelor)
      RETURN id(v) AS vid, v.age AS age
    Then the result should be, in any order:
      | vid          | age |
      | 'Tim Duncan' | 42  |
    And no side effects

The keywords in the preceding example are described as follows:

Keyword Description
Feature Describes the topic of the current .feature file.
Background Describes the background information of the current .feature file.
Given Describes the prerequisites of running the test statements in the current .feature file.
Scenario Describes the purpose of the scenario. If there is the @skip before Scenario, this scenario may not work and don't use it as a working example.
When Describes the nGQL statement to be executed.
Then Describes the expected result of running the statement in the When clause. If the result in your environment does not match the result described in the .feature file, submit an issue to inform the Nebula Graph team.
And Describes the side effects of running the statement in the When clause.
@skip This test case will be skipped. Commonly, the to-be-tested code is not ready.

Welcome to add more practical scenarios and become a Nebula Graph contributor.

About Data Model

Does Nebula Graph support W3C RDF (or SPARQL, GraphQL)?


Nebula Graph's data model is the property graph, and it is a strong schema system.

It doesn't support rdf.

Nebula Graph Query Language does not support SPARQL nor GraphQL.

About executions

How is the time spent value at the end of each return message calculated?

Take the return message of SHOW SPACES as an example:

nebula> SHOW SPACES;
| Name              |
| basketballplayer  |
Got 1 rows (time spent 1235/1934 us)
  • The first number 1235 shows the time spent by the database itself, that is, the time it takes for the query engine to receive a query from the client, fetch the data from the storage server and perform a series of calculations.
  • The second number 1934 shows the time spent from the client's perspective, that is, the time it takes for the client from sending a request, receiving a response, and displaying the result on the screen.

Can I set replica_factor as an even number in CREATE SPACE (e.g., replica_factor = 2) ?


The Storage Service garantees its availability based on the Raft consensus protocol. The number of failed replicas must not exceed half of the total replica number.

When replica_factor=2, if one replica fails, the Storage Service fails. No matter replica_factor=3 or replica_factor=4, if more than one replica fails, the Storage Service fails, so replica_factor=3 is recommended.

To prevent unnecessary waste of resources, we recommend that you set an odd replica number.

We suggest that you set replica_factor to 3 for the production environment and 1 for the test environment. Do not use an even number.

[ERROR (-7)]: SyntaxError: syntax error near '`

In most cases, a query statement requires a YIELD or a RETURN. Check your query statement to see if YIELD or RETURN is provided.

How to count the vertices/edges number of each tag/edge type?

See show-stats.

How to get all the vertices/edge of each tag/edge type?

  1. Create and rebuild the index.

    > CREATE TAG INDEX i_player ON player();
    > REBUILD TAG INDEX i_player;
  2. Use LOOKUP or MATCH.

    > LOOKUP ON player;
    > MATCH (n:player) RETURN n;


Error can’t solve the start vids from the sentence

The graphd requires start vids to begin a graph traversal. The start vids can either be specified by the user, for example,

> GO FROM ${vids} ...
> MATCH (src) WHERE id(src) == ${vids}
# The start vids are explicitly given by ${vids}.

or be found from a (property) index, for example,

# CREATE TAG INDEX i_player ON player(name(20));

> LOOKUP ON player WHERE == "abc" | ... YIELD ...
> MATCH (src) WHERE == "abc" ... 
# The start vids are found from the property index on name.

Otherwise, an error like can’t solve the start vids from the sentence will be raised.

Error Storage Error: The VID must be a 64-bit integer or a string.

Check your vid is an integer or a fix_string(N). If it is a string type, make sure your input is not longer than N (default value is 8). See create space.

About operation and maintenance

The log files are too large. How to recycle the logs

Nebula Graph uses glog to print logs. glog can't recycle the outdated files. You can use crontab to delete them by yourself. Refer to the discussions of Glog should delete old log files automatically.

How to check the Nebula Graph version

  1. Use the <binary_path> --version command to get the Git commit IDs of the Nebula Graph binary files.

    For exmaple, to check the version of the Graph Service, go to the directories where the nebula-graphd binary files are stored, and run ./nebula-graphd --version as follows to get the commit IDs.

    $ ./nebula-graphd --version
    nebula-graphd version Git: ab4f683, Build Time: Mar 24 2021 02:17:30
  2. Search for the commit ID obtained in the preceding step on the GitHub commits page.

  3. Compare the commit time of the binary files with the release time of Nebula Graph versions to find out the version of the Nebula Graph services.

About manual updates

The behavior of manual is not consistent with the system

Nebula Graph 2.0 is still under development. Its behavior changes from time to time. Please tell us if the manual and the system are not consistent.

About connections

Which ports should be opened on the firewalls

If you have not changed the predefined ports in the configurations, open the following ports for the Nebula Graph services:

Service Ports
Meta 9559, 9560, 19559, 19560
Graph 9669, 19669, 19670
Storage 9777 ~ 9780, 19779, 19780

If you have customized the configuration files and changed the predefined ports, find the port numbers in your configuration files and open them on the firewalls.

How to test whether a port is open or closed

You can use telnet as follows to check for port status.

telnet <ip> <port>

NOTE: If you cannot use the telnet command, check if telnet is installed or enabled on your host.

For example:

// If the port is open:
$ telnet 9669
Connected to
Escape character is '^]'.

// If the port is closed or blocked:
$ telnet 9777
telnet: connect to address Connection refused

Last update: November 3, 2021
Back to top