From 3b369260993a3b5a2e0b33f7c9f308c9ff05b703 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Tue, 8 Feb 2022 15:07:36 +0800 Subject: [PATCH] update docs --- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 37 ++++++++++++------- .../2.quick-start/6.cheatsheet-for-ngql.md | 2 +- .../1.nGQL-overview/1.overview.md | 14 +++++-- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/docs-2.0/2.quick-start/4.nebula-graph-crud.md b/docs-2.0/2.quick-start/4.nebula-graph-crud.md index 4e99138e3cd..f1a4379ca3d 100644 --- a/docs-2.0/2.quick-start/4.nebula-graph-crud.md +++ b/docs-2.0/2.quick-start/4.nebula-graph-crud.md @@ -167,9 +167,14 @@ From the **Status** column of the table in the returned results, you can see tha ### nGQL syntax ```ngql -CREATE {TAG | EDGE} { | }( -[, ...]) -[COMMENT = '']; +CREATE {TAG | EDGE} [IF NOT EXISTS] { | } + ( + [NULL | NOT NULL] [DEFAULT ] [COMMENT ''] + [{, [NULL | NOT NULL] [DEFAULT ] [COMMENT '']} ...] + ) + [TTL_DURATION = ] + [TTL_COL = ] + [COMMENT = '']; ``` For more information on parameters, see [CREATE TAG](../3.ngql-guide/10.tag-statements/1.create-tag.md) and [CREATE EDGE](../3.ngql-guide/11.edge-type-statements/1.create-edge.md). @@ -205,7 +210,7 @@ You can use the `INSERT` statement to insert vertices or edges based on existing ```ngql INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...] - VALUES VID: ([prop_value_list]) + VALUES : ([prop_value_list]) tag_props: tag_name ([prop_name_list]) @@ -217,14 +222,18 @@ You can use the `INSERT` statement to insert vertices or edges based on existing [prop_value [, prop_value] ...] ``` - `VID` is short for Vertex ID. A `VID` must be a unique string value in a graph space. For details, see [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md). + `vid` is short for Vertex ID. A `vid` must be a unique string value in a graph space. For details, see [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md). * Insert edges: ```ngql - INSERT EDGE [IF NOT EXISTS] ([, ...]) - VALUES -> [@] : ([, ...]) - [, -> [@] : ([, ...]), ...]; + INSERT EDGE [IF NOT EXISTS] ( ) VALUES + -> [@] : ( ) + [, -> [@] : ( ), ...]; + ::= + [ [, ] ...] + ::= + [ [, ] ...] ``` For more information on parameters, see [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md). @@ -272,10 +281,10 @@ You can use the `INSERT` statement to insert vertices or edges based on existing ```ngql GO [[ TO] STEPS ] FROM OVER [{REVERSELY | BIDIRECT}] - [ WHERE  ] - YIELD [DISTINCT] - [{SAMPLE | LIMIT }] - [| GROUP BY {col_name | expr | position} YIELD ] + [ WHERE ] + YIELD [DISTINCT] + [{ SAMPLE | }] + [| GROUP BY { | expression> | } YIELD ] [| ORDER BY [{ASC | DESC}]] [| LIMIT [,] ]; ``` @@ -303,12 +312,14 @@ You can use the `INSERT` statement to insert vertices or edges based on existing LOOKUP ON { | } [WHERE [AND ...]] YIELD [AS ]; + + [AS ] [, [AS ] ...]; ``` * `MATCH` ```nGQL - MATCH [] RETURN ; + MATCH [] RETURN []; ``` ### Examples of `GO` statement diff --git a/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md b/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md index 41149652dbf..cb5c1c1f92a 100644 --- a/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md +++ b/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md @@ -411,7 +411,7 @@ | Statement | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md) | `INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...] VALUES VID: ([prop_value_list])` | `INSERT VERTEX t2 (name, age) VALUES "13":("n3", 12), "14":("n4", 8)` | Inserts one or more vertices into a graph space in Nebula Graph. | +| [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md) | `INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...] VALUES : ([prop_value_list])` | `INSERT VERTEX t2 (name, age) VALUES "13":("n3", 12), "14":("n4", 8)` | Inserts one or more vertices into a graph space in Nebula Graph. | | [DELETE VERTEX](../3.ngql-guide/12.vertex-statements/4.delete-vertex.md) | `DELETE VERTEX [, ...]` | `DELETE VERTEX "team1"` | Deletes vertices and the related incoming and outgoing edges of the vertices. | | [UPDATE VERTEX](../3.ngql-guide/12.vertex-statements/2.update-vertex.md) | `UPDATE VERTEX ON SET [WHEN ] [YIELD ]` | `UPDATE VERTEX ON player "player101" SET age = age + 2 ` | Updates properties on tags of a vertex. | | [UPSERT VERTEX](../3.ngql-guide/12.vertex-statements/3.upsert-vertex.md) | `UPSERT VERTEX ON SET [WHEN ] [YIELD ]` | `UPSERT VERTEX ON player "player667" SET age = 31` | The `UPSERT` statement is a combination of `UPDATE` and `INSERT`. You can use `UPSERT VERTEX` to update the properties of a vertex if it exists or insert a new vertex if it does not exist. | diff --git a/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md b/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md index 64f2473efab..43552b110e2 100644 --- a/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md +++ b/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md @@ -40,17 +40,23 @@ For details of the symbols in nGQL syntax, see the following table: | Token | Meaning | | ---- | ---- | | < > | name of a syntactic element | -| ::= | formula that defines an element | +| : | formula that defines an element | | [ ] | optional elements | | { } | explicitly specified elements | | \| | complete alternative elements | | ... | may be repeated any number of times | -For example, create vertices or edges in nGQL syntax: +For example, create vertices in nGQL syntax: ```ngql -CREATE {TAG | EDGE} { | }( -[, ...]); +INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...] +VALUES : ([prop_value_list]) +tag_props: + tag_name ([prop_name_list]) +prop_name_list: + [prop_name [, prop_name] ...] +prop_value_list: + [prop_value [, prop_value] ...] ``` Example statement: