Skip to content

Commit

Permalink
update docs (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper-lzy authored Feb 8, 2022
1 parent 283c28a commit 39ee412
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
37 changes: 24 additions & 13 deletions docs-2.0/2.quick-start/4.nebula-graph-crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} {<tag_name> | <edge_type>}(<property_name> <data_type>
[, <property_name> <data_type> ...])
[COMMENT = '<comment>'];
CREATE {TAG | EDGE} [IF NOT EXISTS] {<tag_name> | <edge_type_name>}
(
<prop_name> <data_type> [NULL | NOT NULL] [DEFAULT <default_value>] [COMMENT '<comment>']
[{, <prop_name> <data_type> [NULL | NOT NULL] [DEFAULT <default_value>] [COMMENT '<comment>']} ...]
)
[TTL_DURATION = <ttl_duration>]
[TTL_COL = <prop_name>]
[COMMENT = '<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).
Expand Down Expand Up @@ -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 <vid>: ([prop_value_list])
tag_props:
tag_name ([prop_name_list])
Expand All @@ -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] <edge_type> (<property_name>[, <property_name>...])
VALUES <src_vid> -> <dst_vid>[@<rank>] : (<property_value>[, <property_value>...])
[, <src_vid> -> <dst_vid>[@<rank>] : (<property_name>[, <property_name>...]), ...];
INSERT EDGE [IF NOT EXISTS] <edge_type> ( <prop_name_list> ) VALUES
<src_vid> -> <dst_vid>[@<rank>] : ( <prop_value_list> )
[, <src_vid> -> <dst_vid>[@<rank>] : ( <prop_value_list> ), ...];
<prop_name_list> ::=
[ <prop_name> [, <prop_name> ] ...]
<prop_value_list> ::=
[ <prop_value> [, <prop_value> ] ...]
```
For more information on parameters, see [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md).
Expand Down Expand Up @@ -272,10 +281,10 @@ You can use the `INSERT` statement to insert vertices or edges based on existing
```ngql
GO [[<M> TO] <N> STEPS ] FROM <vertex_list>
OVER <edge_type_list> [{REVERSELY | BIDIRECT}]
[ WHERE <conditions> ]
YIELD [DISTINCT] <return_list>
[{SAMPLE <sample_list> | LIMIT <limit_list>}]
[| GROUP BY {col_name | expr | position} YIELD <col_name>]
[ WHERE <conditions> ]
YIELD [DISTINCT] <return_list>
[{ SAMPLE <sample_list> | <limit_by_list_clause> }]
[| GROUP BY {<col_name> | expression> | <position>} YIELD <col_name>]
[| ORDER BY <expression> [{ASC | DESC}]]
[| LIMIT [<offset>,] <number_rows>];
```
Expand Down Expand Up @@ -303,12 +312,14 @@ You can use the `INSERT` statement to insert vertices or edges based on existing
LOOKUP ON {<vertex_tag> | <edge_type>}
[WHERE <expression> [AND <expression> ...]]
YIELD <return_list> [AS <alias>];
<return_list>
<prop_name> [AS <col_alias>] [, <prop_name> [AS <prop_alias>] ...];
```
* `MATCH`
```nGQL
MATCH <pattern> [<WHERE clause>] RETURN <output>;
MATCH <pattern> [<clause_1>] RETURN <output> [<clause_2>];
```
### Examples of `GO` statement
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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. |
| [DELETE VERTEX](../3.ngql-guide/12.vertex-statements/4.delete-vertex.md) | `DELETE VERTEX <vid> [, <vid> ...]` | `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 <tag_name> <vid> SET <update_prop> [WHEN <condition>] [YIELD <output>]` | `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 <tag> <vid> SET <update_prop> [WHEN <condition>] [YIELD <output>]` | `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. |
Expand Down
14 changes: 10 additions & 4 deletions docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} {<tag_name> | <edge_type>}(<property_name> <data_type>
[, <property_name> <data_type> ...]);
INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...]
VALUES <vid>: ([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:
Expand Down

0 comments on commit 39ee412

Please sign in to comment.