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 9985994545e..4319e8212f8 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 @@ -122,7 +122,7 @@ | Function| Description | | :------ | :------------------------------------------------------ | - | count() |Syntax: `count({expr \| *})` .
`count()`returns the number of rows (including NULL).
`count(expr)`returns the number of non-NULL values that meet the expression.
count() and size() are different. | + | count() |Syntax: `count({expr | *})` .
`count()`returns the number of rows (including NULL).
`count(expr)`returns the number of non-NULL values that meet the expression.
count() and size() are different. | @@ -227,11 +227,11 @@ | Match edges | `MATCH (v:player{name:"Tim Duncan"})-[e]-(v2) RETURN e` | Besides using `--`, `-->`, or `<--` to indicate a nameless edge, you can use a user-defined variable in a pair of square brackets to represent a named edge. For example: `-[e]-`. | | Match an edge type | `MATCH ()-[e:follow]-() RETURN e` |Just like vertices, you can specify an edge type with `:` in a pattern. For example: `-[e:follow]-`. | | Match edge type properties | ` MATCH (v:player{name:"Tim Duncan"})-[e:follow{degree:95}]->(v2) RETURN e` | You can specify edge type properties with `{: }` in a pattern. For example: `[e:follow{likeness:95}]`. | - | Match multiple edge types | `MATCH (v:player{name:"Tim Duncan"})-[e:follow \| :serve]->(v2) RETURN e` | The `|` symbol can help matching multiple edge types. For example: `[e:follow|:serve]`. The English colon (:) before the first edge type cannot be omitted, but the English colon before the subsequent edge type can be omitted, such as `[e:follow|serve]`. | + | Match multiple edge types | `MATCH (v:player{name:"Tim Duncan"})-[e:follow | :serve]->(v2) RETURN e` | The `|` symbol can help matching multiple edge types. For example: `[e:follow|:serve]`. The English colon (:) before the first edge type cannot be omitted, but the English colon before the subsequent edge type can be omitted, such as `[e:follow|serve]`. | | Match multiple edges | `MATCH (v:player{name:"Tim Duncan"})-[]->(v2)<-[e:serve]-(v3) RETURN v2, v3` | You can extend a pattern to match multiple edges in a path. | | Match fixed-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) RETURN DISTINCT v2 AS Friends` | You can use the `:*` pattern to match a fixed-length path. `hop` must be a non-negative integer. | | Match variable-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2) RETURN v2 AS Friends` | `minHop`: Optional. It represents the minimum length of the path. `minHop`: must be a non-negative integer. The default value is 1.
`maxHop`: Required. It represents the maximum length of the path. `maxHop` must be a non-negative integer. It has no default value. | - | Match variable-length paths with multiple edge types | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow \| serve*2]->(v2) RETURN DISTINCT v2` | You can specify multiple edge types in a fixed-length or variable-length pattern. In this case, `hop`, `minHop`, and `maxHop` take effect on all edge types. | + | Match variable-length paths with multiple edge types | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow | serve*2]->(v2) RETURN DISTINCT v2` | You can specify multiple edge types in a fixed-length or variable-length pattern. In this case, `hop`, `minHop`, and `maxHop` take effect on all edge types. | | Retrieve vertex or edge information | `MATCH (v:player{name:"Tim Duncan"}) RETURN v`
`MATCH (v:player{name:"Tim Duncan"})-[e]->(v2) RETURN e` | Use `RETURN { | }` to retrieve all the information of a vertex or an edge. | | Retrieve VIDs | `MATCH (v:player{name:"Tim Duncan"}) RETURN id(v)` | Use the `id()` function to retrieve VIDs. | | Retrieve tags | `MATCH (v:player{name:"Tim Duncan"}) RETURN labels(v)` | Use the `labels()` function to retrieve the list of tags on a vertex.
To retrieve the nth element in the `labels(v)` list, use `labels(v)[n-1]`. | @@ -259,8 +259,8 @@ | Retrieve edges | `LOOKUP ON follow WHERE follow.degree == 90 YIELD follow.degree` | Returns edges whose `degree` is `90` and the edge type is `follow`. | | List vertices with a tag | `LOOKUP ON player` | Shows how to retrieve the VID of all vertices tagged with `player`. | | List edges with an edge types | `LOOKUP ON like` | Shows how to retrieve the source Vertex IDs, destination vertex IDs, and ranks of all edges of the `like` edge type. | - | Count the numbers of vertices or edges | `LOOKUP ON player \| YIELD COUNT(*) AS Player_Number` | Shows how to count the number of vertices tagged with `player`. | - | Count the numbers of edges | `LOOKUP ON like \| YIELD COUNT(*) AS Like_Number` | Shows how to count the number of edges of the `like` edge type. | + | Count the numbers of vertices or edges | `LOOKUP ON player | YIELD COUNT(*) AS Player_Number` | Shows how to count the number of vertices tagged with `player`. | + | Count the numbers of edges | `LOOKUP ON like | YIELD COUNT(*) AS Like_Number` | Shows how to count the number of edges of the `like` edge type. | @@ -283,9 +283,9 @@ | `GO FROM "player100", "player102" OVER serve WHERE properties(edge).start_year > 1995 YIELD DISTINCT properties($$).name AS team_name, properties(edge).start_year AS start_year, properties($^).name AS player_name` | Adds a filter for the traversal. | | `GO FROM "player100" OVER follow, serve YIELD properties(edge).degree, properties(edge).start_year` | The following example traverses along with multiple edge types. If there is no value for a property, the output is `UNKNOWN_PROP`. | | `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS destination` | The following example returns the neighbor vertices in the incoming direction of player 100. | - | `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id \| GO FROM $-.id OVER serve WHERE properties($^).age > 20 YIELD properties($^).name AS FriendOf, properties($$).name AS Team` | The following example retrieves the friends of player 100 and the teams that they serve. | + | `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id | GO FROM $-.id OVER serve WHERE properties($^).age > 20 YIELD properties($^).name AS FriendOf, properties($$).name AS Team` | The following example retrieves the friends of player 100 and the teams that they serve. | | `GO FROM "player102" OVER follow YIELD dst(edge) AS both` | The following example returns all the neighbor vertices of player 102. | - | `GO 2 STEPS FROM "player100" OVER follow YIELD src(edge) AS src, dst(edge) AS dst, properties($$).age AS age \| GROUP BY $-.dst YIELD $-.dst AS dst, collect_set($-.src) AS src, collect($-.age) AS age` | The following example the outputs according to age. | + | `GO 2 STEPS FROM "player100" OVER follow YIELD src(edge) AS src, dst(edge) AS dst, properties($$).age AS age | GROUP BY $-.dst YIELD $-.dst AS dst, collect_set($-.src) AS src, collect($-.age) AS age` | The following example the outputs according to age. | @@ -309,7 +309,7 @@ | `FETCH PROP ON serve "player100" -> "team204" YIELD serve.start_year` | Use a `YIELD` clause to fetch specific properties of an edge. | | `FETCH PROP ON serve "player100" -> "team204", "player133" -> "team202"` | Specify multiple edge patterns (` -> [@]`) to fetch properties of multiple edges. Separate the edge patterns with commas. | | `FETCH PROP ON serve "player100" -> "team204"@1` | To fetch on an edge whose rank is not 0, set its rank in the FETCH statement. | - | `GO FROM "player101" OVER follow YIELD follow._src AS s, follow._dst AS d \| FETCH PROP ON follow $-.s -> $-.d YIELD follow.degree` | The following statement returns the `degree` values of the `follow` edges that start from vertex `"player101"`. | + | `GO FROM "player101" OVER follow YIELD follow._src AS s, follow._dst AS d | FETCH PROP ON follow $-.s -> $-.d YIELD follow.degree` | The following statement returns the `degree` values of the `follow` edges that start from vertex `"player101"`. | | `$var = GO FROM "player101" OVER follow YIELD follow._src AS s, follow._dst AS d; FETCH PROP ON follow $var.s -> $var.d YIELD follow.degree` | You can use user-defined variables to construct similar queries. | @@ -335,16 +335,16 @@ | [SHOW CHARSET](../3.ngql-guide/7.general-query-statements/6.show/1.show-charset.md) | `SHOW CHARSET` | `SHOW CHARSET` | Shows the available character sets. | | [SHOW COLLATION](../3.ngql-guide/7.general-query-statements/6.show/2.show-collation.md) | `SHOW COLLATION` | `SHOW COLLATION` | Shows the collations supported by Nebula Graph. | | [SHOW CREATE SPACE](../3.ngql-guide/7.general-query-statements/6.show/4.show-create-space.md) | `SHOW CREATE SPACE ` | `SHOW CREATE SPACE basketballplayer` | Shows the creating statement of the specified graph space. | - | [SHOW CREATE TAG/EDGE](../3.ngql-guide/7.general-query-statements/6.show/5.show-create-tags-edges.md) | `SHOW CREATE {TAG \| EDGE }` | `SHOW CREATE TAG player` | Shows the basic information of the specified tag. | - | [SHOW HOSTS](../3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md) | `SHOW HOSTS [GRAPH \| STORAGE \| META]` | `SHOW HOSTS`
`SHOW HOSTS GRAPH` | Shows the host and version information of Graph Service, Storage Service, and Meta Service. | - | [SHOW INDEX STATUS](../3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md) | `SHOW {TAG \| EDGE} INDEX STATUS` | `SHOW TAG INDEX STATUS` | Shows the status of jobs that rebuild native indexes, which helps check whether a native index is successfully rebuilt or not. | - | [SHOW INDEXES](../3.ngql-guide/7.general-query-statements/6.show/8.show-indexes.md) | `SHOW {TAG \| EDGE} INDEXES` | `SHOW TAG INDEXES` | Shows the names of existing native indexes. | + | [SHOW CREATE TAG/EDGE](../3.ngql-guide/7.general-query-statements/6.show/5.show-create-tags-edges.md) | `SHOW CREATE {TAG | EDGE }` | `SHOW CREATE TAG player` | Shows the basic information of the specified tag. | + | [SHOW HOSTS](../3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md) | `SHOW HOSTS [GRAPH | STORAGE | META]` | `SHOW HOSTS`
`SHOW HOSTS GRAPH` | Shows the host and version information of Graph Service, Storage Service, and Meta Service. | + | [SHOW INDEX STATUS](../3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md) | `SHOW {TAG | EDGE} INDEX STATUS` | `SHOW TAG INDEX STATUS` | Shows the status of jobs that rebuild native indexes, which helps check whether a native index is successfully rebuilt or not. | + | [SHOW INDEXES](../3.ngql-guide/7.general-query-statements/6.show/8.show-indexes.md) | `SHOW {TAG | EDGE} INDEXES` | `SHOW TAG INDEXES` | Shows the names of existing native indexes. | | [SHOW PARTS](../3.ngql-guide/7.general-query-statements/6.show/9.show-parts.md) | `SHOW PARTS []` | `SHOW PARTS` | Shows the information of a specified partition or all partitions in a graph space. | | [SHOW ROLES](../3.ngql-guide/7.general-query-statements/6.show/10.show-roles.md) | `SHOW ROLES IN ` | `SHOW ROLES in basketballplayer` | Shows the roles that are assigned to a user account. | | [SHOW SNAPSHOTS](../3.ngql-guide/7.general-query-statements/6.show/11.show-snapshots.md) | `SHOW SNAPSHOTS` | `SHOW SNAPSHOTS` | Shows the information of all the snapshots. | [SHOW SPACES](../3.ngql-guide/7.general-query-statements/6.show/12.show-spaces.md) | `SHOW SPACES` | `SHOW SPACES` | Shows existing graph spaces in Nebula Graph. | | [SHOW STATS](../3.ngql-guide/7.general-query-statements/6.show/14.show-stats.md) | `SHOW STATS` | `SHOW STATS` | Shows the statistics of the graph space collected by the latest `STATS` job. | - | [SHOW TAGS/EDGES](../3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md) | `SHOW TAGS \| EDGES` | `SHOW TAGS`、`SHOW EDGES` | Shows all the tags in the current graph space. | + | [SHOW TAGS/EDGES](../3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md) | `SHOW TAGS | EDGES` | `SHOW TAGS`、`SHOW EDGES` | Shows all the tags in the current graph space. | | [SHOW USERS](../3.ngql-guide/7.general-query-statements/6.show/16.show-users.md) | `SHOW USERS` | `SHOW USERS` | Shows the user information. | | [SHOW SESSIONS](../3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md) | `SHOW SESSIONS ` | ` SHOW SESSIONS` | Shows the information of all the sessions. | | [SHOW SESSIONS](../3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md) | `SHOW SESSION ` | `SHOW SESSION 1623304491050858` | Shows a specified session with its ID. | @@ -357,15 +357,15 @@ | Clause | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [GROUP BY](../3.ngql-guide/8.clauses-and-options/group-by.md) | ` GROUP BY YIELD , ` | `GO FROM "player100" OVER follow BIDIRECT YIELD $$.player.name as Name \| GROUP BY $-.Name YIELD $-.Name as Player, count(*) AS Name_Count` | Finds all the vertices connected directly to vertex `"player100"`, groups the result set by player names, and counts how many times the name shows up in the result set. | -| [LIMIT](../3.ngql-guide/8.clauses-and-options/limit.md) | `YIELD [\| LIMIT [,] ]` | `O FROM "player100" OVER follow REVERSELY YIELD $$.player.name AS Friend, $$.player.age AS Age \| ORDER BY $-.Age, $-.Friend \| LIMIT 1, 3` | Returns the 3 rows of data starting from the second row of the sorted output. | +| [GROUP BY](../3.ngql-guide/8.clauses-and-options/group-by.md) | ` GROUP BY YIELD , ` | `GO FROM "player100" OVER follow BIDIRECT YIELD $$.player.name as Name | GROUP BY $-.Name YIELD $-.Name as Player, count(*) AS Name_Count` | Finds all the vertices connected directly to vertex `"player100"`, groups the result set by player names, and counts how many times the name shows up in the result set. | +| [LIMIT](../3.ngql-guide/8.clauses-and-options/limit.md) | `YIELD [| LIMIT [,] ]` | `O FROM "player100" OVER follow REVERSELY YIELD $$.player.name AS Friend, $$.player.age AS Age | ORDER BY $-.Age, $-.Friend | LIMIT 1, 3` | Returns the 3 rows of data starting from the second row of the sorted output. | | [SKIP](../3.ngql-guide/8.clauses-and-options/limit.md) | `RETURN [SKIP ] [LIMIT ]` | `MATCH (v:player{name:"Tim Duncan"}) --> (v2) RETURN v2.name AS Name, v2.age AS Age ORDER BY Age DESC SKIP 1` | `SKIP` can be used alone to set the offset and return the data after the specified position. | -| [ORDER BY](../3.ngql-guide/8.clauses-and-options/order-by.md) | ` ORDER BY [ASC \| DESC] [, [ASC \| DESC] ...]` | `FETCH PROP ON player "player100", "player101", "player102", "player103" YIELD player.age AS age, player.name AS name \| ORDER BY $-.age ASC, $-.name DESC` | The `ORDER BY` clause specifies the order of the rows in the output. | -| [RETURN](../3.ngql-guide/8.clauses-and-options/return.md) | `RETURN {\|\|.\|.\|...}` | `MATCH (v:player) RETURN v.name, v.age LIMIT 3` | Returns the first three rows with values of the vertex properties `name` and `age`. | +| [ORDER BY](../3.ngql-guide/8.clauses-and-options/order-by.md) | ` ORDER BY [ASC | DESC] [, [ASC | DESC] ...]` | `FETCH PROP ON player "player100", "player101", "player102", "player103" YIELD player.age AS age, player.name AS name | ORDER BY $-.age ASC, $-.name DESC` | The `ORDER BY` clause specifies the order of the rows in the output. | +| [RETURN](../3.ngql-guide/8.clauses-and-options/return.md) | `RETURN {||.|.|...}` | `MATCH (v:player) RETURN v.name, v.age LIMIT 3` | Returns the first three rows with values of the vertex properties `name` and `age`. | | [TTL](../3.ngql-guide/8.clauses-and-options/ttl-options.md) | ``CREATE TAG ( , , ...) ttl_duration= , ttl_col = `` | `CREATE TAG t2(a int, b int, c string) ttl_duration= 100, ttl_col = "a"` | Create a tag and set the TTL options. | -| [WHERE](../3.ngql-guide/8.clauses-and-options/where.md) | `WHERE {. {>\|==\|<\|...} ...}` | `MATCH (v:player) WHERE v.name == "Tim Duncan" XOR (v.age < 30 AND v.name == "Yao Ming") OR NOT (v.name == "Yao Ming" OR v.name == "Tim Duncan") RETURN v.name, v.age` | The `WHERE` clause filters the output by conditions. The `WHERE` clause usually works in Native nGQL `GO` and `LOOKUP` statements, and OpenCypher `MATCH` and `WITH` statements. | -| [YIELD](../3.ngql-guide/8.clauses-and-options/yield.md) | `YIELD [DISTINCT] [AS ] [, [AS ] ...] [WHERE ];` | `GO FROM "player100" OVER follow YIELD dst(edge) AS ID \| FETCH PROP ON player $-.ID YIELD player.age AS Age \| YIELD AVG($-.Age) as Avg_age, count(*)as Num_friends` | Finds the players that "player100" follows and calculates their average age. | -| [WITH](../3.ngql-guide/8.clauses-and-options/with.md) | `MATCH $expressions WITH {nodes()\|labels()\|...}` | `MATCH p=(v:player{name:"Tim Duncan"})--() WITH nodes(p) AS n UNWIND n AS n1 RETURN DISTINCT n1` | The `WITH` clause can retrieve the output from a query part, process it, and pass it to the next query part as the input. | +| [WHERE](../3.ngql-guide/8.clauses-and-options/where.md) | `WHERE {. {>|==|<|...} ...}` | `MATCH (v:player) WHERE v.name == "Tim Duncan" XOR (v.age < 30 AND v.name == "Yao Ming") OR NOT (v.name == "Yao Ming" OR v.name == "Tim Duncan") RETURN v.name, v.age` | The `WHERE` clause filters the output by conditions. The `WHERE` clause usually works in Native nGQL `GO` and `LOOKUP` statements, and OpenCypher `MATCH` and `WITH` statements. | +| [YIELD](../3.ngql-guide/8.clauses-and-options/yield.md) | `YIELD [DISTINCT] [AS ] [, [AS ] ...] [WHERE ];` | `GO FROM "player100" OVER follow YIELD dst(edge) AS ID | FETCH PROP ON player $-.ID YIELD player.age AS Age | YIELD AVG($-.Age) as Avg_age, count(*)as Num_friends` | Finds the players that "player100" follows and calculates their average age. | +| [WITH](../3.ngql-guide/8.clauses-and-options/with.md) | `MATCH $expressions WITH {nodes()|labels()|...}` | `MATCH p=(v:player{name:"Tim Duncan"})--() WITH nodes(p) AS n UNWIND n AS n1 RETURN DISTINCT n1` | The `WITH` clause can retrieve the output from a query part, process it, and pass it to the next query part as the input. | @@ -373,7 +373,7 @@ | Statement | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ----------------------------------------------------- | ------------------------------------------------------------ | -| [CREATE SPACE](../3.ngql-guide/9.space-statements/1.create-space.md) | `CREATE SPACE [IF NOT EXISTS] ( [partition_num = ,] [replica_factor = ,] vid_type = {FIXED_STRING()\| INT[64]} ) [COMMENT = '']` | `CREATE SPACE my_space_1 (vid_type=FIXED_STRING(30))` | Creates a graph space with | +| [CREATE SPACE](../3.ngql-guide/9.space-statements/1.create-space.md) | `CREATE SPACE [IF NOT EXISTS] ( [partition_num = ,] [replica_factor = ,] vid_type = {FIXED_STRING()| INT[64]} ) [COMMENT = '']` | `CREATE SPACE my_space_1 (vid_type=FIXED_STRING(30))` | Creates a graph space with | | [CREATE SPACE](../3.ngql-guide/9.space-statements/1.create-space.md) | `CREATE SPACE AS ` | `CREATE SPACE my_space_4 as my_space_3` | Clone a graph space. | | [USE](../3.ngql-guide/9.space-statements/2.use-space.md) | `USE ` | `USE space1` | Specifies a graph space as the current working graph space for subsequent queries. | | [SHOW SPACES](../3.ngql-guide/9.space-statements/3.show-spaces.md) | `SHOW SPACES` | `SHOW SPACES` | Lists all the graph spaces in the Nebula Graph examples. | @@ -386,7 +386,7 @@ | Statement | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [CREATE TAG](../3.ngql-guide/10.tag-statements/1.create-tag.md) | `CREATE TAG [IF NOT EXISTS] ( [NULL \| NOT NULL] [DEFAULT ] [COMMENT ''] [{, [NULL \| NOT NULL] [DEFAULT ] [COMMENT '']} ...] ) [TTL_DURATION = ] [TTL_COL = ] [COMMENT = ''] ` | `CREATE TAG woman(name string, age int, married bool, salary double, create_time timestamp) TTL_DURATION = 100, TTL_COL = "create_time"` | Creates a tag with the given name in a graph space. | +| [CREATE TAG](../3.ngql-guide/10.tag-statements/1.create-tag.md) | `CREATE TAG [IF NOT EXISTS] ( [NULL | NOT NULL] [DEFAULT ] [COMMENT ''] [{, [NULL | NOT NULL] [DEFAULT ] [COMMENT '']} ...] ) [TTL_DURATION = ] [TTL_COL = ] [COMMENT = ''] ` | `CREATE TAG woman(name string, age int, married bool, salary double, create_time timestamp) TTL_DURATION = 100, TTL_COL = "create_time"` | Creates a tag with the given name in a graph space. | | [DROP TAG](../3.ngql-guide/10.tag-statements/2.drop-tag.md) | `DROP TAG [IF EXISTS] ` | `CREATE TAG test(p1 string, p2 int)` | Drops a tag with the given name in the current working graph space. | | [ALTER TAG](../3.ngql-guide/10.tag-statements/3.alter-tag.md) | `ALTER TAG [, alter_definition] ...] [ttl_definition [, ttl_definition] ... ] [COMMENT = '']` | `ALTER TAG t1 ADD (p3 int, p4 string)` | Alters the structure of a tag with the given name in a graph space. You can add or drop properties, and change the data type of an existing property. You can also set a [TTL](../3.ngql-guide/8.clauses-and-options/ttl-options.md(Time-To-Live)on a property, or change its TTL duration. | | [SHOW TAGS](../3.ngql-guide/10.tag-statements/4.show-tags.md) | `SHOW TAGS` | `SHOW TAGS` | Shows the name of all tags in the current graph space. | @@ -399,7 +399,7 @@ | Statement | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | --------------------------------------------------- | -| [CREATE EDGE](../3.ngql-guide/11.edge-type-statements/1.create-edge.md) | `CREATE EDGE [IF NOT EXISTS] ( [NULL \| NOT NULL] [DEFAULT ] [COMMENT ''] [{, [NULL \| NOT NULL] [DEFAULT ] [COMMENT '']} ...] ) [TTL_DURATION = ] [TTL_COL = ] [COMMENT = ''] ` | `CREATE EDGE e1(p1 string, p2 int, p3 timestamp) TTL_DURATION = 100, TTL_COL = "p2"` | Creates an edge type with the given name in a graph space.type。 | +| [CREATE EDGE](../3.ngql-guide/11.edge-type-statements/1.create-edge.md) | `CREATE EDGE [IF NOT EXISTS] ( [NULL | NOT NULL] [DEFAULT ] [COMMENT ''] [{, [NULL | NOT NULL] [DEFAULT ] [COMMENT '']} ...] ) [TTL_DURATION = ] [TTL_COL = ] [COMMENT = ''] ` | `CREATE EDGE e1(p1 string, p2 int, p3 timestamp) TTL_DURATION = 100, TTL_COL = "p2"` | Creates an edge type with the given name in a graph space.type。 | | [DROP EDGE](../3.ngql-guide/11.edge-type-statements/2.drop-edge.md) | `DROP EDGE [IF EXISTS] ` | `DROP EDGE e1` | Drops an edge type with the given name in a graph space. | | [ALTER EDGE](../3.ngql-guide/11.edge-type-statements/3.alter-edge.md) | `ALTER EDGE [, alter_definition] ...] [ttl_definition [, ttl_definition] ... ] [COMMENT = '']` | `ALTER EDGE e1 ADD (p3 int, p4 string)` | Alters the structure of an edge type with the given name in a graph space. | | [SHOW EDGES](../3.ngql-guide/11.edge-type-statements/4.show-edges.md) | `SHOW EDGES` | `SHOW EDGES` | Shows all edge types in the current graph space. | @@ -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] () [, (), ...] {VALUES \| VALUE} VID: ([, ])` | `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] () [, (), ...] {VALUES | VALUE} VID: ([, ])` | `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. | @@ -422,7 +422,7 @@ | Statement | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md) | `INSERT EDGE [IF NOT EXISTS] ( ) {VALUES \| VALUE} -> [@] : ( ) [, -> [@] : ( ), ...]` | `INSERT EDGE e2 (name, age) VALUES "11"->"13":("n1", 1)` | Inserts an edge or multiple edges into a graph space from a source vertex (given by src_vid) to a destination vertex (given by dst_vid) with a specific rank in Nebula Graph. | +| [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md) | `INSERT EDGE [IF NOT EXISTS] ( ) {VALUES | VALUE} -> [@] : ( ) [, -> [@] : ( ), ...]` | `INSERT EDGE e2 (name, age) VALUES "11"->"13":("n1", 1)` | Inserts an edge or multiple edges into a graph space from a source vertex (given by src_vid) to a destination vertex (given by dst_vid) with a specific rank in Nebula Graph. | | [DELETE EDGE](../3.ngql-guide/12.vertex-statements/3.upsert-vertex.md) | `DELETE EDGE -> [@] [, -> [@] ...]` | `DELETE EDGE serve "player100" -> "team204"@0` | Deletes one edge or multiple edges at a time. | | [UPDATE EDGE](../3.ngql-guide/13.edge-statements/2.update-edge.md) | `UPDATE EDGE ON -> [@] SET [WHEN ] [YIELD ]` | `UPDATE EDGE ON serve "player100" -> "team204"@0 SET start_year = start_year + 1` | Updates properties on an edge. | | [UPSERT EDGE](../3.ngql-guide/12.vertex-statements/3.upsert-vertex.md) | `UPSERT EDGE ON -> [@rank] SET [WHEN ] [YIELD ]` | `UPSERT EDGE on serve "player666" -> "team200"@0 SET end_year = 2021` | The `UPSERT` statement is a combination of `UPDATE` and `INSERT`. You can use `UPSERT EDGE` to update the properties of an edge if it exists or insert a new edge if it does not exist. | @@ -437,13 +437,13 @@ | Statement | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------- | ------------------------------------------------------------ | - | [CREATE INDEX](../3.ngql-guide/14.native-index-statements/1.create-native-index.md) | `CREATE {TAG \| EDGE} INDEX [IF NOT EXISTS] ON { \| } ([]) [COMMENT = '']` | `CREATE TAG INDEX player_index on player()` | Add native indexes for the existing tags, edge types, or properties. | - | [SHOW CREATE INDEX](../3.ngql-guide/14.native-index-statements/2.1.show-create-index.md) | `SHOW CREATE {TAG \| EDGE} INDEX ` | `show create tag index index_2` | Shows the statement used when creating a tag or an edge type. It contains detailed information about the index, such as its associated properties. | - | [SHOW INDEXES](../3.ngql-guide/14.native-index-statements/2.show-native-indexes.md) | `SHOW {TAG \| EDGE} INDEXES` | `SHOW TAG INDEXES` | Shows the defined tag or edge type indexes names in the current graph space. | - | [DESCRIBE INDEX](../3.ngql-guide/14.native-index-statements/3.describe-native-index.md) | `DESCRIBE {TAG \| EDGE} INDEX ` | `DESCRIBE TAG INDEX player_index_0` | Gets the information about the index with a given name, including the property name (Field) and the property type (Type) of the index. | - | [REBUILD INDEX](../3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md) | `REBUILD {TAG \| EDGE} INDEX []` | `REBUILD TAG INDEX single_person_index` | Rebuilds the created tag or edge type index. If data is updated or inserted before the creation of the index, you must rebuild the indexes **manually** to make sure that the indexes contain the previously added data. | - | [SHOW INDEX STATUS](../3.ngql-guide/14.native-index-statements/5.show-native-index-status.md) | `SHOW {TAG \| EDGE} INDEX STATUS` | `SHOW TAG INDEX STATUS` | Returns the name of the created tag or edge type index and its status. | - | [DROP INDEX](../3.ngql-guide/14.native-index-statements/6.drop-native-index.md) | `DROP {TAG \| EDGE} INDEX [IF EXISTS] ` | `DROP TAG INDEX player_index_0` | Removes an existing index from the current graph space. | + | [CREATE INDEX](../3.ngql-guide/14.native-index-statements/1.create-native-index.md) | `CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] ON { | } ([]) [COMMENT = '']` | `CREATE TAG INDEX player_index on player()` | Add native indexes for the existing tags, edge types, or properties. | + | [SHOW CREATE INDEX](../3.ngql-guide/14.native-index-statements/2.1.show-create-index.md) | `SHOW CREATE {TAG | EDGE} INDEX ` | `show create tag index index_2` | Shows the statement used when creating a tag or an edge type. It contains detailed information about the index, such as its associated properties. | + | [SHOW INDEXES](../3.ngql-guide/14.native-index-statements/2.show-native-indexes.md) | `SHOW {TAG | EDGE} INDEXES` | `SHOW TAG INDEXES` | Shows the defined tag or edge type indexes names in the current graph space. | + | [DESCRIBE INDEX](../3.ngql-guide/14.native-index-statements/3.describe-native-index.md) | `DESCRIBE {TAG | EDGE} INDEX ` | `DESCRIBE TAG INDEX player_index_0` | Gets the information about the index with a given name, including the property name (Field) and the property type (Type) of the index. | + | [REBUILD INDEX](../3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md) | `REBUILD {TAG | EDGE} INDEX []` | `REBUILD TAG INDEX single_person_index` | Rebuilds the created tag or edge type index. If data is updated or inserted before the creation of the index, you must rebuild the indexes **manually** to make sure that the indexes contain the previously added data. | + | [SHOW INDEX STATUS](../3.ngql-guide/14.native-index-statements/5.show-native-index-status.md) | `SHOW {TAG | EDGE} INDEX STATUS` | `SHOW TAG INDEX STATUS` | Returns the name of the created tag or edge type index and its status. | + | [DROP INDEX](../3.ngql-guide/14.native-index-statements/6.drop-native-index.md) | `DROP {TAG | EDGE} INDEX [IF EXISTS] ` | `DROP TAG INDEX player_index_0` | Removes an existing index from the current graph space. | @@ -454,11 +454,11 @@ | `SIGN IN TEXT SERVICE [( [,, ]), (), ...]` | `SIGN IN TEXT SERVICE (127.0.0.1:9200)` | The full-text indexes is implemented based on [Elasticsearch](https://en.wikipedia.org/wiki/Elasticsearch). After deploying an Elasticsearch cluster, you can use the `SIGN IN` statement to log in to the Elasticsearch client. | | `SHOW TEXT SEARCH CLIENTS` | `SHOW TEXT SEARCH CLIENTS` | Shows text search clients. | | `SIGN OUT TEXT SERVICE` | `SIGN OUT TEXT SERVICE` |Signs out to the text search clients. | - | `CREATE FULLTEXT {TAG \| EDGE} INDEX ON { \| } ([])` | `CREATE FULLTEXT TAG INDEX nebula_index_1 ON player(name)` | Creates full-text indexes. | + | `CREATE FULLTEXT {TAG | EDGE} INDEX ON { | } ([])` | `CREATE FULLTEXT TAG INDEX nebula_index_1 ON player(name)` | Creates full-text indexes. | | `SHOW FULLTEXT INDEXES` | `SHOW FULLTEXT INDEXES` | Show full-text indexes. | | `REBUILD FULLTEXT INDEX` | `REBUILD FULLTEXT INDEX` | Rebuild full-text indexes. | | `DROP FULLTEXT INDEX ` | `DROP FULLTEXT INDEX nebula_index_1` | Drop full-text indexes. | - | `LOOKUP ON { \| } WHERE [YIELD ]` | `LOOKUP ON player WHERE FUZZY(player.name, "Tim Dunncan", AUTO, OR) YIELD player.name` | Use query options. | + | `LOOKUP ON { | } WHERE [YIELD ]` | `LOOKUP ON player WHERE FUZZY(player.name, "Tim Dunncan", AUTO, OR) YIELD player.name` | Use query options. | @@ -466,8 +466,8 @@ | Type | Syntax | Example | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [GET SUBGRAPH](../3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md) | `GET SUBGRAPH [WITH PROP] [ STEPS] FROM {, ...} [{IN \| OUT \| BOTH} , ...] [YIELD [VERTICES AS ] [,EDGES AS ]] ` | `GET SUBGRAPH 1 STEPS FROM "player100" YIELD VERTICES AS nodes, EDGES AS relationships` | Retrieves information of vertices and edges reachable from the source vertices of the specified edge types and returns information of the subgraph. | -| [FIND PATH](../3.ngql-guide/16.subgraph-and-path/2.find-path.md) | `FIND { SHORTEST \| ALL \| NOLOOP } PATH [WITH PROP] FROM TO
OVER [REVERSELY \| BIDIRECT] [] [UPTO STEPS] [\| ORDER BY $-.path] [\| LIMIT ]` | `FIND SHORTEST PATH FROM "player102" TO "team204" OVER *` | Finds the paths between the selected source vertices and destination vertices. A returned path is like `()-[:@]->( STEPS] FROM {, ...} [{IN | OUT | BOTH} , ...] [YIELD [VERTICES AS ] [,EDGES AS ]] ` | `GET SUBGRAPH 1 STEPS FROM "player100" YIELD VERTICES AS nodes, EDGES AS relationships` | Retrieves information of vertices and edges reachable from the source vertices of the specified edge types and returns information of the subgraph. | +| [FIND PATH](../3.ngql-guide/16.subgraph-and-path/2.find-path.md) | `FIND { SHORTEST | ALL | NOLOOP } PATH [WITH PROP] FROM TO
OVER [REVERSELY | BIDIRECT] [] [UPTO STEPS] [| ORDER BY $-.path] [| LIMIT ]` | `FIND SHORTEST PATH FROM "player102" TO "team204" OVER *` | Finds the paths between the selected source vertices and destination vertices. A returned path is like `()-[:@]->(` | `EXPLAIN format="row" SHOW TAGS`
`EXPLAIN format="dot" SHOW TAGS` | Helps output the execution plan of an nGQL statement without executing the statement. | -| [PROFILE](../3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md) | `PROFILE [format="row" \| "dot"] ` | `PROFILE format="row" SHOW TAGS`
`EXPLAIN format="dot" SHOW TAGS` | Executes the statement, then outputs the execution plan as well as the execution profile. | +| [EXPLAIN](../3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md) | `EXPLAIN [format="row" | "dot"] ` | `EXPLAIN format="row" SHOW TAGS`
`EXPLAIN format="dot" SHOW TAGS` | Helps output the execution plan of an nGQL statement without executing the statement. | +| [PROFILE](../3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md) | `PROFILE [format="row" | "dot"] ` | `PROFILE format="row" SHOW TAGS`
`EXPLAIN format="dot" SHOW TAGS` | Executes the statement, then outputs the execution plan as well as the execution profile. |