diff --git a/docs/nGQL.md b/docs/nGQL.md index dbba710e862..55412013817 100644 --- a/docs/nGQL.md +++ b/docs/nGQL.md @@ -1,7 +1,7 @@ # Nebula Graph Query Language (nGQL) ## About nGQL -`NGQL` is a declarative, textual query language like SQL, but for graphs. Unlike SQL, nGQL is all about expressing graph patterns. NGQL is a work in progress. We will add more features and further simplify the existing ones. +`nGQL` is a declarative, textual query language like SQL, but for graphs. Unlike SQL, nGQL is all about expressing graph patterns. nGQL is a work in progress. We will add more features and further simplify the existing ones. There might be inconsistency between the syntax specs and implementation for the time being. ## Goals - Easy to learn - Easy to understand @@ -98,7 +98,7 @@ #### Choose a graph space Nebula supports multiple graph spaces. Data in different graph spaces are physically isolated. Before executing a query, a graph space needs to be selected using the following statement -**USE ** +**USE** #### Return a data set Simply return a single value or a data set @@ -107,22 +107,22 @@ Simply return a single value or a data set ::= **vid** | | | -#### Define a tag +#### Create a tag The following statement defines a **new** tag -**DEFINE TAG** () +**CREATE TAG** () - ::= - ::= + - ::= - ::= + ::=
+ ::= +
+ ::= ,
+ ::=
#### Modify a tag type -#### Define an edge type +#### Create an edge type The following statement defines a **new** edge type -**DEFINE EDGE** () +**CREATE EDGE** () := @@ -131,13 +131,13 @@ The following statement defines a **new** edge type #### Insert vertices The following statement inserts one or more vertices -**INSERT VERTEX** [**NO OVERWRITE**] "("
-[ [ **WITH** [()] **VALUES** () ]+ ]+
-")" +**INSERT VERTEX** [**NO OVERWRITE**] **VALUES**
- ::= **vid** - ::= (, )+ - ::= **VALUE** (, **VALUE**)* + ::= () (, ())\*
+ ::= :() (, :())\*
+ ::= **vid**
+ ::= (, )\*
+ ::= **VALUE** (, **VALUE**)\*
#### Insert edges @@ -155,9 +155,9 @@ The following statement updates a vertex [**WHERE** ] [**YIELD** ] - ::= | - ::= = {, = }+ - ::= () = () | () = + ::= |
+ ::= = {, = }+
+ ::= () = () | () =
#### Update an edge The following statement updates an edge @@ -177,17 +177,17 @@ Navigate from given vertices to their neighbors according to the given condition [**WHERE** ] [**YIELD** ] - ::= **integer** | **integer** **TO** **integer** | **UPTO** **interger** + ::= **integer** | **integer** **TO** **integer** | **UPTO** **interger**
::= [data\_set] [[**AS**] ]
::= **vid** | | |
::= [**AS** ] - ::= {, }\* - ::= + ::= {, }\*
+ ::=
- ::= {**AND** | **OR** }\* - ::= **>** | **>=** | **<** | **<=** | **==** | **!=** | **IN** - ::= {, }\* - ::= [**AS** ] + ::= {**AND** | **OR** }\*
+ ::= **>** | **>=** | **<** | **<=** | **==** | **!=** | **IN**
+ ::= {, }\*
+ ::= [**AS** ]
**WHERE** clause only applies to the results that are going to be returned. It will not be applied to the intermediate results (See the detail description of the **STEP[S]** clause) @@ -240,10 +240,10 @@ The following statement does a pattern match, and can return tuple list or paths ### Property Reference It's common to refer a property in the statement, such as in **WHERE** clause and **YIELD** clause. In nGQL, the reference to a property is defined as - ::= "." - ::= | | - ::= - ::= '[' "]" + ::= "."
+ ::= | |
+ ::=
+ ::= '[' "]"
always starts with "$". There are two special variables: $_ and $$.