From f131d7ec9fd567ec33cbffa93ca47ed83c01c7e6 Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:28:53 +0800 Subject: [PATCH 1/7] command change in batch add properties(edge/$$/$^)/src(edge)/dst(edge)... --- .../3.graph-service.md | 8 +- docs-2.0/14.client/4.nebula-java-client.md | 2 +- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 60 ++++++++------- .../1.nGQL-overview/1.overview.md | 6 +- .../1.nGQL-overview/ngql-style-guide.md | 22 +++--- .../12.vertex-statements/4.delete-vertex.md | 2 +- .../13.edge-statements/2.update-edge.md | 2 +- .../13.edge-statements/4.delete-edge.md | 4 +- docs-2.0/3.ngql-guide/3.data-types/6.list.md | 4 +- .../1.composite-queries.md | 20 +++-- .../2.user-defined-variables.md | 20 +++-- .../3.property-reference.md | 20 ++--- .../3.ngql-guide/5.operators/1.comparison.md | 8 +- docs-2.0/3.ngql-guide/5.operators/4.pipe.md | 3 +- .../5.operators/5.property-reference.md | 6 +- docs-2.0/3.ngql-guide/5.operators/6.set.md | 40 +++++----- docs-2.0/3.ngql-guide/5.operators/7.string.md | 14 ++-- .../6.functions-and-expressions/1.math.md | 16 ++-- .../6.functions-and-expressions/11.reduce.md | 4 +- .../6.functions-and-expressions/13.concat.md | 4 +- .../5.case-expressions.md | 24 +++--- .../6.functions-and-expressions/7.count.md | 2 +- .../7.general-query-statements/4.fetch.md | 58 +++++++-------- .../7.general-query-statements/5.lookup.md | 46 ++++++------ .../8.clauses-and-options/group-by.md | 4 +- .../8.clauses-and-options/limit.md | 2 +- .../8.clauses-and-options/order-by.md | 2 +- .../8.clauses-and-options/where.md | 73 +++++++++---------- .../8.clauses-and-options/yield.md | 2 +- .../use-console/st-ug-open-in-explore.md | 2 +- 30 files changed, 251 insertions(+), 229 deletions(-) diff --git a/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md b/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md index 6ff3b73f000..c1a34bf1174 100644 --- a/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md +++ b/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md @@ -20,7 +20,7 @@ After a query is sent to Graph Service, it will be processed by the following fo After receiving a request, the statements will be parsed by the Parser composed of Flex (lexical analysis tool) and Bison (syntax analysis tool), and its corresponding AST will be generated. Statements will be directly intercepted in this stage because of its invalid syntax. -For example, the structure of the AST of `GO FROM "Tim" OVER like WHERE like.likeness > 8.0 YIELD like._dst` is shown in the following picture. +For example, the structure of the AST of `GO FROM "Tim" OVER like WHERE properties(edge).likeness > 8.0 YIELD dst(edge)` is shown in the following picture. ![AST](https://docs-cdn.nebula-graph.com.cn/docs-2.0/1.introduction/2.nebula-graph-architecture/parser-ast-tree.png) @@ -38,7 +38,7 @@ Validator performs a series of validations on the AST. It mainly works on these Validator will verify whether the cited variable exists or not, or whether the cited property is variable or not. - For composite statements, like `$var = GO FROM "Tim" OVER like YIELD like._dst AS ID; GO FROM $var.ID OVER serve YIELD serve._dst`, Validator verifies first to see if `var` is defined, and then to check if the `ID` property is attached to the `var` variable. + For composite statements, like `$var = GO FROM "Tim" OVER like YIELD dst(edge) AS ID; GO FROM $var.ID OVER serve YIELD dst(edge)`, Validator verifies first to see if `var` is defined, and then to check if the `ID` property is attached to the `var` variable. - Validating type inference @@ -50,13 +50,13 @@ Validator performs a series of validations on the AST. It mainly works on these Validator needs to verify all the Schema that involves `*` when verifying the clause if there is a `*` in the statement. - Take a statement like `GO FROM "Tim" OVER * YIELD like._dst, like.likeness, serve._dst` as an example. When verifying the `OVER` clause, Validator needs to verify all the edge types. If the edge type includes `like` and `serve`, the statement would be `GO FROM "Tim" OVER like,serve YIELD like._dst, like.likeness, serve._dst`. + Take a statement like `GO FROM "Tim" OVER * YIELD dst(edge), properties(edge).likeness, dst(edge)` as an example. When verifying the `OVER` clause, Validator needs to verify all the edge types. If the edge type includes `like` and `serve`, the statement would be `GO FROM "Tim" OVER like,serve YIELD dst(edge), properties(edge).likeness, dst(edge)`. - Validating input and output Validator will check the consistency of the clauses before and after the `|`. - In the statement `GO FROM "Tim" OVER like YIELD like._dst AS ID | GO FROM $-.ID OVER serve YIELD serve._dst`, Validator will verify whether `$-.ID` is defined in the clause before the `|`. + In the statement `GO FROM "Tim" OVER like YIELD dst(edge) AS ID | GO FROM $-.ID OVER serve YIELD dst(edge)`, Validator will verify whether `$-.ID` is defined in the clause before the `|`. When the validation succeeds, an execution plan will be generated. Its data structure will be stored in the `src/planner` directory. diff --git a/docs-2.0/14.client/4.nebula-java-client.md b/docs-2.0/14.client/4.nebula-java-client.md index a31987523ad..6c2e6b0673a 100644 --- a/docs-2.0/14.client/4.nebula-java-client.md +++ b/docs-2.0/14.client/4.nebula-java-client.md @@ -101,7 +101,7 @@ try { ResultSet resp = session.execute(insertEdges); // query - String query = "GO FROM \"Bob\" OVER like " + "YIELD $$.person.name, $$.person.age, like.likeness"; + String query = "GO FROM \"Bob\" OVER like " + "YIELD properties($$).name, properties($$).age, properties(edge).likeness"; ResultSet resp = session.execute(query); printResult(resp); }finally { 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 8f6a7d30227..127ba504a05 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 @@ -324,14 +324,15 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * Filter the players that the player with VID `player100` follows whose age is equal to or greater than 35. Rename the corresponding columns in the results with `Teammate` and `Age`. ```ngql - nebula> GO FROM "player100" OVER follow WHERE $$.player.age >= 35 \ - YIELD $$.player.name AS Teammate, $$.player.age AS Age; - +---------------+-----+ - | Teammate | Age | - +---------------+-----+ - | "Tony Parker" | 36 | - +---------------+-----+ - Got 1 rows (time spent 8206/9335 us) + nebula> GO FROM "player100" OVER follow WHERE properties($$).age >= 35 \ + YIELD properties($$).name AS Teammate, properties($$).age AS Age; + +-----------------+-----+ + | Teammate | Age | + +-----------------+-----+ + | "Tony Parker" | 36 | + +-----------------+-----+ + | "Manu Ginobili" | 41 | + +-----------------+-----+ ``` |Clause/Sign|Description| @@ -345,15 +346,18 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * With a pipe: ```ngql - nebula> GO FROM "player100" OVER follow YIELD follow._dst AS id | \ - GO FROM $-.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; - +-----------+---------------+ - | Team | Player | - +-----------+---------------+ - | "Nuggets" | "Tony Parker" | - +-----------+---------------+ - Got 1 rows (time spent 5055/8203 us) + nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ + GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; + +-----------+-----------------+ + | Team | Player | + +-----------+-----------------+ + | "Spurs" | "Tony Parker" | + +-----------+-----------------+ + | "Hornets" | "Tony Parker" | + +-----------+-----------------+ + | "Spurs" | "Manu Ginobili" | + +-----------+-----------------+ ``` |Clause/Sign|Description| @@ -369,15 +373,18 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi Once a composite statement is submitted to the server as a whole, the life cycle of the temporary variables in the statement ends. ```ngql - nebula> $var = GO FROM "player100" OVER follow YIELD follow._dst AS id; \ - GO FROM $var.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; - +---------+-------------+ - | Team | Player | - +---------+-------------+ - | Nuggets | Tony Parker | - +---------+-------------+ - Got 1 rows (time spent 3103/3711 us) + nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ + GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; + +-----------+-----------------+ + | Team | Player | + +-----------+-----------------+ + | "Spurs" | "Tony Parker" | + +-----------+-----------------+ + | "Hornets" | "Tony Parker" | + +-----------+-----------------+ + | "Spurs" | "Manu Ginobili" | + +-----------+-----------------+ ``` ### Example of `FETCH` statement @@ -391,7 +398,6 @@ nebula> FETCH PROP ON player "player100"; +----------------------------------------------------+ | ("player100" :player{age: 42, name: "Tim Duncan"}) | +----------------------------------------------------+ -Got 1 rows (time spent 2006/2406 us) ``` !!! Note 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 3f87dcf5f04..28217d2fc4e 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 @@ -153,8 +153,8 @@ Feature: Comparison of where clause When profiling query: """ GO FROM "player100" OVER follow - WHERE follow.degree IN [v IN [95,99] WHERE v > 0] - YIELD follow._dst, follow.degree + WHERE properties(edge).degree IN [v IN [95,99] WHERE v > 0] + YIELD dst(edge), properties(edge).degree """ Then the result should be, in any order: | follow._dst | follow.degree | @@ -163,7 +163,7 @@ Feature: Comparison of where clause And the execution plan should be: | id | name | dependencies | operator info | | 0 | Project | 1 | | - | 1 | GetNeighbors | 2 | {"filter": "(follow.degree IN [v IN [95,99] WHERE (v>0)])"} | + | 1 | GetNeighbors | 2 | {"filter": "(properties(edge).degree IN [v IN [95,99] WHERE (v>0)])"} | | 2 | Start | | | ``` diff --git a/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md b/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md index f9ab9fed1e0..889f0c4cefd 100644 --- a/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md +++ b/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md @@ -13,7 +13,7 @@ nGQL does not have strict formatting requirements, but creating nGQL statements Not recommended: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id; + GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id; ``` Recommended: @@ -21,7 +21,7 @@ nGQL does not have strict formatting requirements, but creating nGQL statements ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD follow._dst AS id; + YIELD src(edge) AS id; ``` 2. Start a new line to write different statements in a composite statement. @@ -29,8 +29,8 @@ nGQL does not have strict formatting requirements, but creating nGQL statements Not recommended: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id | GO FROM $-.id \ - OVER serve WHERE $^.player.age > 20 YIELD $^.player.name AS FriendOf, $$.team.name AS Team; + 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; ``` Recommended: @@ -38,10 +38,10 @@ nGQL does not have strict formatting requirements, but creating nGQL statements ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD follow._dst AS id | \ + YIELD src(edge) AS id | \ GO FROM $-.id OVER serve \ - WHERE $^.player.age > 20 \ - YIELD $^.player.name AS FriendOf, $$.team.name AS Team; + WHERE properties($^).age > 20 \ + YIELD properties($^).name AS FriendOf, properties($$).name AS Team; ``` 3. If the clause exceeds 80 characters, start a new line at the appropriate place. @@ -218,10 +218,10 @@ The strings should be surrounded by double quotes. ```ngql GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id; | \ + YIELD dst(edge) AS id; | \ GO FROM $-.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` Supported: @@ -229,10 +229,10 @@ The strings should be surrounded by double quotes. ```ngql GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id | \ + YIELD dst(edge) AS id | \ GO FROM $-.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` 3. In a composite statement that contains user-defined variables, use an English semicolon to end the statements that define the variables. If you do not follow the rules to add a semicolon or use a pipe to end the composite statement, the execution will fail. diff --git a/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md b/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md index 32c95ba8003..6b7ff3b3626 100644 --- a/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md +++ b/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md @@ -27,7 +27,7 @@ nebula> DELETE VERTEX "team1"; This query shows that you can use `DELETE VERTEX` together with pipe to delete vertices. ```ngql -nebula> GO FROM "player100" OVER serve WHERE serve.start_year == "2021" YIELD serve._dst AS id | DELETE VERTEX $-.id; +nebula> GO FROM "player100" OVER serve WHERE properties(edge).start_year == "2021" YIELD dst(edge) AS id | DELETE VERTEX $-.id; ``` ## Delete the process and the related edges diff --git a/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md index 053050759a3..6a681d62256 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md @@ -31,7 +31,7 @@ The following example checks the properties of the edge with the GO statement. ```ngql nebula> GO FROM "player100" \ OVER serve \ - YIELD serve.start_year, serve.end_year; + YIELD properties(edge).start_year, properties(edge).end_year; +------------------+----------------+ | serve.start_year | serve.end_year | +------------------+----------------+ diff --git a/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md index 07966f5d598..3373baeaa92 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md @@ -24,7 +24,7 @@ The following example shows that you can use `DELETE EDGE` together with pipe op ```ngql nebula> GO FROM "player100" OVER follow \ - WHERE follow._dst == "team204" \ - YIELD follow._src AS src, follow._dst AS dst, follow._rank AS rank \ + WHERE dst(edge) == "team204" \ + YIELD src(edge) AS src, dst(edge) AS dst, rank(edge) AS rank \ | DELETE EDGE follow $-.src->$-.dst @ $-.rank; ``` diff --git a/docs-2.0/3.ngql-guide/3.data-types/6.list.md b/docs-2.0/3.ngql-guide/3.data-types/6.list.md index 750c826c95e..8018a3939fa 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/6.list.md +++ b/docs-2.0/3.ngql-guide/3.data-types/6.list.md @@ -180,8 +180,8 @@ nebula> RETURN size([1,2,3]); +---------------+ # The following query calculates the elements in the list [92,90] and runs a conditional judgment in a where clause. -nebula> GO FROM "player100" OVER follow WHERE follow.degree NOT IN [x IN [92, 90] | x + $$.player.age] \ - YIELD follow._dst AS id, follow.degree AS degree; +nebula> GO FROM "player100" OVER follow WHERE properties(edge).degree NOT IN [x IN [92, 90] | x + $$.player.age] \ + YIELD dst(edge) AS id, properties(edge).degree AS degree; +-------------+--------+ | id | degree | +-------------+--------+ diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md index b72b3bb6dee..8ed7ef39b82 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md @@ -58,12 +58,16 @@ For example, a query is composed of three sub-queries: `A B C`, `A | B | C` or ` ```ngql # Connect multiple queries with pipes. - nebula> GO FROM "player100" OVER follow YIELD follow._dst AS id | \ - GO FROM $-.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; - +---------+-------------+ - | Team | Player | - +---------+-------------+ - | Nuggets | Tony Parker | - +---------+-------------+ + nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ + GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; + +-----------+-----------------+ + | Team | Player | + +-----------+-----------------+ + | "Spurs" | "Tony Parker" | + +-----------+-----------------+ + | "Hornets" | "Tony Parker" | + +-----------+-----------------+ + | "Spurs" | "Manu Ginobili" | + +-----------+-----------------+ ``` diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md index f9c0ec5dce8..7e4cd05c410 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md @@ -32,12 +32,16 @@ You can use user-defined variables in composite queries. Details about composite ## Example ```ngql -nebula> $var = GO FROM "player100" OVER follow YIELD follow._dst AS id; \ - GO FROM $var.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; -+---------+-------------+ -| Team | Player | -+---------+-------------+ -| Nuggets | Tony Parker | -+---------+-------------+ +nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ + GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; ++-----------+-----------------+ +| Team | Player | ++-----------+-----------------+ +| "Spurs" | "Tony Parker" | ++-----------+-----------------+ +| "Hornets" | "Tony Parker" | ++-----------+-----------------+ +| "Spurs" | "Manu Ginobili" | ++-----------+-----------------+ ``` diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md index bf329c5124e..e877cbc658b 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md @@ -61,7 +61,7 @@ Apart from the user-defined edge property, there are four built-in properties in The following query returns the `name` property of the `player` tag on the source vertex and the `age` property of the `player` tag on the destination vertex. ```ngql -nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.player.age AS endAge; +nebula> GO FROM "player100" OVER follow YIELD properties($^).name AS startName, properties($$).age AS endAge; +--------------+--------+ | startName | endAge | +--------------+--------+ @@ -74,7 +74,7 @@ nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.pl The following query returns the `degree` property of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD follow.degree; +nebula> GO FROM "player100" OVER follow YIELD properties(edge).degree; +---------------+ | follow.degree | +---------------+ @@ -87,12 +87,12 @@ nebula> GO FROM "player100" OVER follow YIELD follow.degree; The following query returns the source vertex, the destination vertex, the edge type, and the edge rank value of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD follow._src, follow._dst, follow._type, follow._rank; -+-------------+-------------+--------------+--------------+ -| follow._src | follow._dst | follow._type | follow._rank | -+-------------+-------------+--------------+--------------+ -| "player100" | "player101" | 136 | 0 | -+-------------+-------------+--------------+--------------+ -| "player100" | "player102" | 136 | 0 | -+-------------+-------------+--------------+--------------+ +nebula> GO FROM "player100" OVER follow YIELD src(edge), dst(edge), type(edge), rank(edge); ++-------------+-------------+------------+------------+ +| src(EDGE) | dst(EDGE) | type(EDGE) | rank(EDGE) | ++-------------+-------------+------------+------------+ +| "player100" | "player101" | "follow" | 0 | ++-------------+-------------+------------+------------+ +| "player100" | "player125" | "follow" | 0 | ++-------------+-------------+------------+------------+ ``` diff --git a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md index aabee9ac329..9b634f51a21 100644 --- a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md +++ b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md @@ -190,13 +190,15 @@ nebula> RETURN "a" IS NOT EMPTY; | true | +------------------+ -nebula> GO FROM "player100" OVER * WHERE $$.player.name IS NOT EMPTY YIELD follow._dst; +nebula> GO FROM "player100" OVER * WHERE properties($$).name IS NOT EMPTY YIELD dst(edge); +-------------+ -| follow._dst | +| dst(EDGE) | +-------------+ -| "player125" | +| "team204" | +-------------+ | "player101" | +-------------+ +| "player125" | ++-------------+ ``` diff --git a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md index 686afe14187..99df7df1ed0 100644 --- a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md +++ b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md @@ -18,7 +18,7 @@ One major difference between nGQL and SQL is how sub-queries are composed. ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD follow._dst AS dstid, $$.player.name AS Name | \ + YIELD dst(edge) AS dstid, properties($$).name AS Name | \ GO FROM $-.dstid OVER follow; +-------------+ @@ -26,6 +26,7 @@ nebula> GO FROM "player100" OVER follow \ +-------------+ | "player101" | +-------------+ +|... | ``` If there is no `YIELD` clause to define the output, the destination vertex ID is returned by default. If a YIELD clause is applied, the output is defined by the YIELD clause. diff --git a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md index 7636c079fe8..ee25735a540 100644 --- a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md +++ b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md @@ -18,7 +18,7 @@ Reference operators apply to native nGQL only. ```ngql # The following example returns the age of the source vertex and the destination vertex. -nebula> GO FROM "player100" OVER follow YIELD $^.player.age AS SrcAge, $$.player.age AS DestAge; +nebula> GO FROM "player100" OVER follow YIELD properties($^).age AS SrcAge, properties($$).age AS DestAge; +--------+---------+ | SrcAge | DestAge | +--------+---------+ @@ -29,9 +29,9 @@ nebula> GO FROM "player100" OVER follow YIELD $^.player.age AS SrcAge, $$.player # The following example returns the name and team of the players that player100 follows. nebula> GO FROM "player100" OVER follow \ - YIELD follow._dst AS id | \ + YIELD dst(edge) AS id | \ GO FROM $-.id OVER serve \ - YIELD $^.player.name AS Player, $$.team.name AS Team; + YIELD $^.player.name AS Player, properties($$).name AS Team; +-----------------+-----------+ | Player | Team | +-----------------+-----------+ diff --git a/docs-2.0/3.ngql-guide/5.operators/6.set.md b/docs-2.0/3.ngql-guide/5.operators/6.set.md index 8f733911ad5..7c863446ee6 100644 --- a/docs-2.0/3.ngql-guide/5.operators/6.set.md +++ b/docs-2.0/3.ngql-guide/5.operators/6.set.md @@ -28,7 +28,7 @@ nebula> GO FROM "player102" OVER follow \ UNION \ GO FROM "player100" OVER follow; +-------------+ -| follow._dst | +| dst(edge) | +-------------+ | "player101" | +-------------+ @@ -40,7 +40,7 @@ nebula> GO FROM "player102" OVER follow \ UNION ALL \ GO FROM "player100" OVER follow; +-------------+ -| follow._dst | +| dst(edge) | +-------------+ | "player101" | +-------------+ @@ -51,18 +51,20 @@ nebula> GO FROM "player102" OVER follow \ # UNION can also work with the YIELD statement. The DISTINCT keyword will check duplication by all the columns for every line, and remove duplicated lines if every column is the same. nebula> GO FROM "player102" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age \ + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age \ UNION /* DISTINCT */ \ GO FROM "player100" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age; + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; +-------------+--------+-----+ | id | Degree | Age | +-------------+--------+-----+ -| "player101" | 75 | 36 | +| "player100" | 75 | 42 | +-------------+--------+-----+ -| "player101" | 96 | 36 | +| "player101" | 75 | 36 | +-------------+--------+-----+ -| "player102" | 90 | 33 | +| "player101" | 95 | 36 | ++-------------+--------+-----+ +| "player125" | 95 | 41 | +-------------+--------+-----+ ``` @@ -80,10 +82,10 @@ nebula> GO FROM "player102" OVER follow \ ```ngql nebula> GO FROM "player102" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age \ + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age \ INTERSECT \ GO FROM "player100" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age; + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; Empty set (time spent 2990/3511 us) ``` @@ -102,7 +104,7 @@ nebula> GO FROM "player100" OVER follow \ MINUS \ GO FROM "player102" OVER follow; +-------------+ -| follow._dst | +| dst(edge) | +-------------+ | "player102" | +-------------+ @@ -121,18 +123,22 @@ Please note that when a query contains a pipe `|` and a set operator, the pipe t ```ngql nebula> GO FROM "player102" OVER follow \ - YIELD follow._dst AS play_dst \ + YIELD dst(edge) AS play_dst \ UNION \ GO FROM "team200" OVER serve REVERSELY \ - YIELD serve._dst AS play_dst \ - | GO FROM $-.play_dst OVER follow YIELD follow._dst AS play_dst; + YIELD src(edge) AS play_src \ + | GO FROM $-.play_src OVER follow YIELD dst(edge) AS play_dst; +-------------+ | play_dst | +-------------+ +| "player100" | ++-------------+ | "player101" | +-------------+ -| "player102" | +| "player117" | ++-------------+ +| "player105" | +-------------+ ``` @@ -144,11 +150,11 @@ The parentheses can change the execution priority. For example: ```ngql nebula> (GO FROM "player102" OVER follow \ - YIELD follow._dst AS play_dst \ + YIELD dst(edge) AS play_dst \ UNION \ GO FROM "team200" OVER serve REVERSELY \ - YIELD serve._dst AS play_dst) \ - | GO FROM $-.play_dst OVER follow YIELD follow._dst AS play_dst; + YIELD src(edge) AS play_dst) \ + | GO FROM $-.play_dst OVER follow YIELD dst(edge) AS play_dst; ``` In the above query, the statements within the parentheses take precedence. That is, the `UNION` operation will be executed first, and its output will be executed as the input of the next operation with pipes. diff --git a/docs-2.0/3.ngql-guide/5.operators/7.string.md b/docs-2.0/3.ngql-guide/5.operators/7.string.md index 563b8fa26f1..a7be0a24c7d 100644 --- a/docs-2.0/3.ngql-guide/5.operators/7.string.md +++ b/docs-2.0/3.ngql-guide/5.operators/7.string.md @@ -47,19 +47,19 @@ nebula> MATCH (s:player)-[e:serve]->(t:team) WHERE id(s) == "player101" \ | "Tony Parker" | 2018 | 2019 | "Hornets" | +---------------+--------------+------------+-----------+ -nebula> GO FROM "player101" OVER serve WHERE (STRING)serve.start_year CONTAINS "19" AND \ - $^.player.name CONTAINS "ny" \ - YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name; +nebula> GO FROM "player101" OVER serve WHERE (STRING)properties(edge).start_year CONTAINS "19" AND \ + properties($^).name CONTAINS "ny" \ + YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name; +----------------+------------------+----------------+--------------+ -| $^.player.name | serve.start_year | serve.end_year | $$.team.name | +| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | +----------------+------------------+----------------+--------------+ | "Tony Parker" | 1999 | 2018 | "Spurs" | +----------------+------------------+----------------+--------------+ -nebula> GO FROM "player101" OVER serve WHERE !($$.team.name CONTAINS "ets") \ - YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name; +nebula> GO FROM "player101" OVER serve WHERE !(properties($$).name CONTAINS "ets") \ + YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, $$.team.name; +----------------+------------------+----------------+--------------+ -| $^.player.name | serve.start_year | serve.end_year | $$.team.name | +| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | +----------------+------------------+----------------+--------------+ | "Tony Parker" | 1999 | 2018 | "Spurs" | +----------------+------------------+----------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md index a033a07037d..c3de8c36958 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md @@ -53,18 +53,18 @@ double radians() | Converts degrees to radians. `radians(180)` returns `3.141592 ```ngql # The following statement supports aggregate functions. -nebula> GO FROM "Tim Duncan" OVER like YIELD like._dst AS dst, $$.player.age AS age \ +nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS dst, properties($$).age AS age \ | GROUP BY $-.dst \ YIELD \ $-.dst AS dst, \ toInteger((sum($-.age)/count($-.age)))+avg(distinct $-.age+1)+1 AS statistics; -+-----------------+------------+ -| dst | statistics | -+-----------------+------------+ -| "Tony Parker" | 74.0 | -+-----------------+------------+ -| "Manu Ginobili" | 84.0 | -+-----------------+------------+ ++-------------+------------+ +| dst | statistics | ++-------------+------------+ +| "player125" | 84.0 | ++-------------+------------+ +| "player101" | 74.0 | ++-------------+------------+ Got 2 rows (time spent 4739/5064 us) ``` diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md index 52f82fb4be8..194ff32817d 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md @@ -64,8 +64,8 @@ nebula> MATCH p = (n:player{name:"LeBron James"})<-[:follow]-(m) \ nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ | GO FROM $-.VertexID over follow \ - WHERE follow.degree != reduce(totalNum = 5, n IN range(1, 3) | $$.player.age + totalNum + n) \ - YIELD $$.player.name AS id, $$.player.age AS age, follow.degree AS degree; + WHERE properties(edge).degree != reduce(totalNum = 5, n IN range(1, 3) | properties($$).age + totalNum + n) \ + YIELD properties($$).name AS id, properties($$).age AS age, properties(edge).degree AS degree; +---------------------+-----+--------+ | id | age | degree | +---------------------+-----+--------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md index 7be8e392f96..e7d285feed4 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md @@ -36,7 +36,7 @@ nebula> RETURN concat("1","2",NULL) AS r; +----------+ nebula> GO FROM "player100" over follow \ - YIELD concat(follow._src, $^.player.age, $$.player.name, follow.degree) AS A; + YIELD concat(src(edge), properties($^).age, properties($$).name, properties(edge).degree) AS A; +------------------------------+ | A | +------------------------------+ @@ -98,7 +98,7 @@ nebula> RETURN concat_ws("+","a") AS r; +-----+ nebula> GO FROM "player100" over follow \ - YIELD concat_ws(" ",follow._src, $^.player.age, $$.player.name, follow.degree) AS A; + YIELD concat_ws(" ",src(edge), properties($^).age, properties($$).name, properties(edge).degree) AS A; +---------------------------------+ | A | +---------------------------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md index 1cb222df372..2dc2ac22d5b 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md @@ -46,20 +46,20 @@ nebula> RETURN \ ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD $$.player.name AS Name, \ - CASE $$.player.age > 35 \ + YIELD properties($$).name AS Name, \ + CASE properties($$).age > 35 \ WHEN true THEN "Yes" \ WHEN false THEN "No" \ ELSE "Nah" \ END \ AS Age_above_35; -+---------------------+--------------+ -| Name | Age_above_35 | -+---------------------+--------------+ -| "Tony Parker" | "Yes" | -+---------------------+--------------+ -| "LaMarcus Aldridge" | "No" | -+---------------------+--------------+ ++-----------------+--------------+ +| Name | Age_above_35 | ++-----------------+--------------+ +| "Tony Parker" | "Yes" | ++-----------------+--------------+ +| "Manu Ginobili" | "Yes" | ++-----------------+--------------+ ``` ## The generic form of CASE expressions @@ -121,9 +121,9 @@ To avoid the misuse of the simple form and the generic form, it is important to ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD $$.player.name AS Name, $$.player.age AS Age, \ - CASE $$.player.age \ - WHEN $$.player.age > 35 THEN "Yes" \ + YIELD properties($$).name AS Name, properties($$).age AS Age, \ + CASE properties($$).age \ + WHEN properties($$).age > 35 THEN "Yes" \ ELSE "No" \ END \ AS Age_above_35; diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md index 663fd048ea7..7bafb8bd4b8 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md @@ -33,7 +33,7 @@ nebula> WITH [NULL, 1, 1, 2, 2] As a UNWIND a AS b \ ```ngql # The statement in the following example searches for the people whom `player101` follows and people who follow `player101`, i.e. a bidirectional query. nebula> GO FROM "player101" OVER follow BIDIRECT \ - YIELD $$.player.name AS Name \ + YIELD properties($$).name AS Name \ | GROUP BY $-.Name YIELD $-.Name, count(*); +---------------------+----------+ | $-.Name | count(*) | diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md index 5e56cac9f5d..5c5d858b996 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md @@ -156,12 +156,12 @@ Use a `YIELD` clause to fetch specific properties of an edge. ```ngql nebula> FETCH PROP ON serve "player100" -> "team204" \ - YIELD serve.start_year; -+-------------+------------+-------------+------------------+ -| serve._src | serve._dst | serve._rank | serve.start_year | -+-------------+------------+-------------+------------------+ -| "player100" | "team204" | 0 | 1997 | -+-------------+------------+-------------+------------------+ + YIELD properties(edge).start_year; ++-------------+------------+-------------+-----------------------------+ +| serve._src | serve._dst | serve._rank | properties(EDGE).start_year | ++-------------+------------+-------------+-----------------------------+ +| "player100" | "team204" | 0 | 1997 | ++-------------+------------+-------------+-----------------------------+ ``` ### Fetch properties of multiple edges @@ -216,36 +216,36 @@ The following statement returns the `degree` values of the `follow` edges that s ```ngql nebula> GO FROM "player101" OVER follow \ - YIELD follow._src AS s, follow._dst AS d |\ - FETCH PROP ON follow $-.s -> $-.d \ - YIELD follow.degree; -+-------------+-------------+--------------+---------------+ -| follow._src | follow._dst | follow._rank | follow.degree | -+-------------+-------------+--------------+---------------+ -| "player101" | "player100" | 0 | 95 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player125" | 0 | 95 | -+-------------+-------------+--------------+---------------+ + YIELD src(edge) AS s, dst(edge) AS d \ + | FETCH PROP ON follow $-.s -> $-.d \ + YIELD properties(edge).degree; ++-------------+-------------+--------------+-------------------------+ +| follow._src | follow._dst | follow._rank | properties(EDGE).degree | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ ``` Or you can use user-defined variables to construct similar queries. ```ngql nebula> $var = GO FROM "player101" OVER follow \ - YIELD follow._src AS s, follow._dst AS d; \ + YIELD src(edge) AS s, dst(edge) AS d; \ FETCH PROP ON follow $var.s -> $var.d \ - YIELD follow.degree; -+-------------+-------------+--------------+---------------+ -| follow._src | follow._dst | follow._rank | follow.degree | -+-------------+-------------+--------------+---------------+ -| "player101" | "player100" | 0 | 95 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player125" | 0 | 95 | -+-------------+-------------+--------------+---------------+ + YIELD properties(edge).degree; ++-------------+-------------+--------------+-------------------------+ +| follow._src | follow._dst | follow._rank | properties(EDGE).degree | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ ``` For more information about composite queries, see [Composite queries (clause structure)](../4.variable-and-composite-queries/1.composite-queries.md). diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md index 54700afbc1f..07259f017f1 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md @@ -86,7 +86,7 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name == "Tony Parker" \ - YIELD player.name AS name, player.age AS age; + YIELD properties(vertex).name AS name, properties(vertex).age AS age; +-------------+---------------+-----+ | VertexID | name | age | +-------------+---------------+-----+ @@ -106,20 +106,20 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name STARTS WITH "B" \ AND player.age IN [22,30] \ - YIELD player.name, player.age; -+-------------+-----------------+------------+ -| VertexID | player.name | player.age | -+-------------+-----------------+------------+ -| "player149" | "Ben Simmons" | 22 | -+-------------+-----------------+------------+ -| "player134" | "Blake Griffin" | 30 | -+-------------+-----------------+------------+ + YIELD properties(vertex).name, properties(vertex).age; ++-------------+-------------------------+------------------------+ +| VertexID | properties(VERTEX).name | properties(VERTEX).age | ++-------------+-------------------------+------------------------+ +| "player149" | "Ben Simmons" | 22 | ++-------------+-------------------------+------------------------+ +| "player134" | "Blake Griffin" | 30 | ++-------------+-------------------------+------------------------+ nebula> LOOKUP ON player \ WHERE player.name == "Kobe Bryant" \ - YIELD player.name AS name |\ + YIELD properties(vertex).name AS name |\ GO FROM $-.VertexID OVER serve \ - YIELD $-.name, serve.start_year, serve.end_year, $$.team.name; + YIELD $-.name, properties(edge).start_year, properties(edge).end_year, properties($$).name; +---------------+------------------+----------------+--------------+ | $-.name | serve.start_year | serve.end_year | $$.team.name | +---------------+------------------+----------------+--------------+ @@ -156,23 +156,23 @@ nebula> LOOKUP ON follow \ nebula> LOOKUP ON follow \ WHERE follow.degree == 90 \ - YIELD follow.degree; -+-------------+-------------+---------+---------------+ -| SrcVID | DstVID | Ranking | follow.degree | -+-------------+-------------+---------+---------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+---------+---------------+ -| "player133" | "player114" | 0 | 90 | -+-------------+-------------+---------+---------------+ -| "player133" | "player144" | 0 | 90 | -+-------------+-------------+---------+---------------+ + YIELD properties(edge).degree; ++-------------+-------------+---------+-------------------------+ +| SrcVID | DstVID | Ranking | properties(EDGE).degree | ++-------------+-------------+---------+-------------------------+ +| "player121" | "player116" | 0 | 90 | ++-------------+-------------+---------+-------------------------+ +| "player121" | "player128" | 0 | 90 | ++-------------+-------------+---------+-------------------------+ +| "player121" | "player129" | 0 | 90 | ++-------------+-------------+---------+-------------------------+ ... nebula> LOOKUP ON follow \ WHERE follow.degree == 60 \ - YIELD follow.degree AS Degree |\ + YIELD properties(edge).degree AS Degree |\ GO FROM $-.DstVID OVER serve \ - YIELD $-.DstVID, serve.start_year, serve.end_year, $$.team.name; + YIELD $-.DstVID, properties(edge).start_year, properties(edge).end_year, properties($$).name; +-------------+------------------+----------------+--------------+ | $-.DstVID | serve.start_year | serve.end_year | $$.team.name | +-------------+------------------+----------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md index 7d2b2cafaab..4461785baa3 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md @@ -44,7 +44,7 @@ The following statement finds all the vertices connected directly to vertex `"pl ```ngql nebula> GO FROM "player100" OVER follow BIDIRECT \ - YIELD $$.player.name as Name \ + YIELD properties($$).name as Name \ | GROUP BY $-.Name \ YIELD $-.Name as Player, count(*) AS Name_Count; +---------------------+------------+ @@ -78,7 +78,7 @@ The following statement finds all the vertices connected directly to vertex `"pl ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD follow._src AS player, follow.degree AS degree \ + YIELD src(edge) AS player, properties(edge).degree AS degree \ | GROUP BY $-.player \ YIELD sum($-.degree); +----------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md index e758cb399ae..a908352526c 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md @@ -30,7 +30,7 @@ YIELD ```ngql # The following example returns the 3 rows of data starting from the second row of the sorted output. nebula> GO FROM "player100" OVER follow REVERSELY \ - YIELD $$.player.name AS Friend, $$.player.age AS Age \ + YIELD properties($$).name AS Friend, properties($$).age AS Age \ | ORDER BY $-.Age, $-.Friend \ | LIMIT 1, 3; +-------------------+-----+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md index ba985a54ef5..b3802c973a8 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md @@ -41,7 +41,7 @@ nebula> FETCH PROP ON player "player100", "player101", "player102", "player103" +-------------+-----+---------------------+ nebula> $var = GO FROM "player100" OVER follow \ - YIELD follow._dst AS dst; \ + YIELD dst(edge) AS dst; \ ORDER BY $var.dst DESC; +-------------+ | dst | diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md index f32c521bfd1..0dcb4dcc9cc 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md @@ -48,16 +48,15 @@ nebula> MATCH (v:player) \ ```ngql nebula> GO FROM "player100" \ OVER follow \ - WHERE follow.degree > 90 \ - OR $$.player.age != 33 \ - AND $$.player.name != "Tony Parker"; -+-------------+ -| follow._dst | -+-------------+ -| "player101" | -+-------------+ -| "player125" | -+-------------+ + WHERE properties(edge).degree > 90 \ + OR properties($$).age != 33 \ + AND properties($$).name != "Tony Parker" \ + YIELD properties($$); ++----------------------------------+ +| properties($$) | ++----------------------------------+ +| {age: 41, name: "Manu Ginobili"} | ++----------------------------------+ ``` ### Filter on properties @@ -180,20 +179,20 @@ nebula> INSERT EDGE e1(p1) VALUES "1"->"2"@6:(16); # The following example use rank to filter edges and retrieves edges with a rank greater than 2. nebula> GO FROM "1" \ OVER e1 \ - WHERE e1._rank>2 \ - YIELD e1._src, e1._dst, e1._rank AS Rank, e1.p1 | \ + WHERE rank(edge) > 2 \ + YIELD src(edge), dst(edge), rank(edge) AS Rank, properties(edge).p1 | \ ORDER BY $-.Rank DESC; -==================================== -| e1._src | e1._dst | Rank | e1.p1 | -==================================== -| 1 | 2 | 6 | 16 | ------------------------------------- -| 1 | 2 | 5 | 15 | ------------------------------------- -| 1 | 2 | 4 | 14 | ------------------------------------- -| 1 | 2 | 3 | 13 | ------------------------------------- ++-----------+-----------+------+---------------------+ +| src(EDGE) | dst(EDGE) | Rank | properties(EDGE).p1 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 6 | 16 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 5 | 15 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 4 | 14 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 3 | 13 | ++-----------+-----------+------+---------------------+ ``` ## Filter on strings @@ -340,20 +339,20 @@ nebula> MATCH (v:player) \ | "Joel Embiid" | 25 | +-------------------------+-------+ -nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD player.name, player.age; -+-------------+------------------+------------+ -| VertexID | player.name | player.age | -+-------------+------------------+------------+ -| "player135" | "Damian Lillard" | 28 | -+-------------+------------------+------------+ -| "player131" | "Paul George" | 28 | -+-------------+------------------+------------+ -| "player130" | "Joel Embiid" | 25 | -+-------------+------------------+------------+ -| "player123" | "Ricky Rubio" | 28 | -+-------------+------------------+------------+ -| "player106" | "Kyle Anderson" | 25 | -+-------------+------------------+------------+ +nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD properties(vertex).name, properties(vertex).age; ++-------------+-------------------------+------------------------+ +| VertexID | properties(VERTEX).name | properties(VERTEX).age | ++-------------+-------------------------+------------------------+ +| "player106" | "Kyle Anderson" | 25 | ++-------------+-------------------------+------------------------+ +| "player135" | "Damian Lillard" | 28 | ++-------------+-------------------------+------------------------+ +| "player130" | "Joel Embiid" | 25 | ++-------------+-------------------------+------------------------+ +| "player131" | "Paul George" | 28 | ++-------------+-------------------------+------------------------+ +| "player123" | "Ricky Rubio" | 28 | ++-------------+-------------------------+------------------------+ ``` ### Match values not in a list diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md index 86ae171dc75..11fa3226d7f 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md @@ -71,7 +71,7 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...]; ```ngql nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ - YIELD player.name, player.age; + YIELD properties(vertex).name, properties(vertex).age; ======================================= | VertexID | player.name | player.age | ======================================= diff --git a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md index fb76c49a09d..a9500b8513d 100644 --- a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md +++ b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md @@ -31,7 +31,7 @@ To query edge data on the **Console** page and then view the result on the **Exp Here is an nGQL statement example. ```ngql - nebula> GO FROM "player102" OVER serve YIELD serve._src,serve._dst; + nebula> GO FROM "player102" OVER serve YIELD src(edge),dst(edge); ``` In the query result, you can see the start year and end year of the service team for the player whose playerId is `palyer102`. As shown below. From 812704288aa1a8c7c3cdebb7109cb77707ce9adf Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:31:07 +0800 Subject: [PATCH 2/7] command changes in batch --- .../3.graph-service.md | 8 +- docs-2.0/14.client/4.nebula-java-client.md | 2 +- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 60 +++++++-------- .../1.nGQL-overview/1.overview.md | 6 +- .../1.nGQL-overview/ngql-style-guide.md | 22 +++--- .../12.vertex-statements/4.delete-vertex.md | 2 +- .../13.edge-statements/2.update-edge.md | 2 +- .../13.edge-statements/4.delete-edge.md | 4 +- docs-2.0/3.ngql-guide/3.data-types/6.list.md | 4 +- .../1.composite-queries.md | 20 ++--- .../2.user-defined-variables.md | 20 ++--- .../3.property-reference.md | 20 ++--- .../3.ngql-guide/5.operators/1.comparison.md | 8 +- docs-2.0/3.ngql-guide/5.operators/4.pipe.md | 3 +- .../5.operators/5.property-reference.md | 6 +- docs-2.0/3.ngql-guide/5.operators/6.set.md | 40 +++++----- docs-2.0/3.ngql-guide/5.operators/7.string.md | 14 ++-- .../6.functions-and-expressions/1.math.md | 16 ++-- .../6.functions-and-expressions/11.reduce.md | 4 +- .../6.functions-and-expressions/13.concat.md | 4 +- .../5.case-expressions.md | 24 +++--- .../6.functions-and-expressions/7.count.md | 2 +- .../7.general-query-statements/4.fetch.md | 58 +++++++-------- .../7.general-query-statements/5.lookup.md | 46 ++++++------ .../8.clauses-and-options/group-by.md | 4 +- .../8.clauses-and-options/limit.md | 2 +- .../8.clauses-and-options/order-by.md | 2 +- .../8.clauses-and-options/where.md | 73 ++++++++++--------- .../8.clauses-and-options/yield.md | 2 +- .../use-console/st-ug-open-in-explore.md | 2 +- 30 files changed, 229 insertions(+), 251 deletions(-) diff --git a/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md b/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md index c1a34bf1174..6ff3b73f000 100644 --- a/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md +++ b/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md @@ -20,7 +20,7 @@ After a query is sent to Graph Service, it will be processed by the following fo After receiving a request, the statements will be parsed by the Parser composed of Flex (lexical analysis tool) and Bison (syntax analysis tool), and its corresponding AST will be generated. Statements will be directly intercepted in this stage because of its invalid syntax. -For example, the structure of the AST of `GO FROM "Tim" OVER like WHERE properties(edge).likeness > 8.0 YIELD dst(edge)` is shown in the following picture. +For example, the structure of the AST of `GO FROM "Tim" OVER like WHERE like.likeness > 8.0 YIELD like._dst` is shown in the following picture. ![AST](https://docs-cdn.nebula-graph.com.cn/docs-2.0/1.introduction/2.nebula-graph-architecture/parser-ast-tree.png) @@ -38,7 +38,7 @@ Validator performs a series of validations on the AST. It mainly works on these Validator will verify whether the cited variable exists or not, or whether the cited property is variable or not. - For composite statements, like `$var = GO FROM "Tim" OVER like YIELD dst(edge) AS ID; GO FROM $var.ID OVER serve YIELD dst(edge)`, Validator verifies first to see if `var` is defined, and then to check if the `ID` property is attached to the `var` variable. + For composite statements, like `$var = GO FROM "Tim" OVER like YIELD like._dst AS ID; GO FROM $var.ID OVER serve YIELD serve._dst`, Validator verifies first to see if `var` is defined, and then to check if the `ID` property is attached to the `var` variable. - Validating type inference @@ -50,13 +50,13 @@ Validator performs a series of validations on the AST. It mainly works on these Validator needs to verify all the Schema that involves `*` when verifying the clause if there is a `*` in the statement. - Take a statement like `GO FROM "Tim" OVER * YIELD dst(edge), properties(edge).likeness, dst(edge)` as an example. When verifying the `OVER` clause, Validator needs to verify all the edge types. If the edge type includes `like` and `serve`, the statement would be `GO FROM "Tim" OVER like,serve YIELD dst(edge), properties(edge).likeness, dst(edge)`. + Take a statement like `GO FROM "Tim" OVER * YIELD like._dst, like.likeness, serve._dst` as an example. When verifying the `OVER` clause, Validator needs to verify all the edge types. If the edge type includes `like` and `serve`, the statement would be `GO FROM "Tim" OVER like,serve YIELD like._dst, like.likeness, serve._dst`. - Validating input and output Validator will check the consistency of the clauses before and after the `|`. - In the statement `GO FROM "Tim" OVER like YIELD dst(edge) AS ID | GO FROM $-.ID OVER serve YIELD dst(edge)`, Validator will verify whether `$-.ID` is defined in the clause before the `|`. + In the statement `GO FROM "Tim" OVER like YIELD like._dst AS ID | GO FROM $-.ID OVER serve YIELD serve._dst`, Validator will verify whether `$-.ID` is defined in the clause before the `|`. When the validation succeeds, an execution plan will be generated. Its data structure will be stored in the `src/planner` directory. diff --git a/docs-2.0/14.client/4.nebula-java-client.md b/docs-2.0/14.client/4.nebula-java-client.md index 6c2e6b0673a..a31987523ad 100644 --- a/docs-2.0/14.client/4.nebula-java-client.md +++ b/docs-2.0/14.client/4.nebula-java-client.md @@ -101,7 +101,7 @@ try { ResultSet resp = session.execute(insertEdges); // query - String query = "GO FROM \"Bob\" OVER like " + "YIELD properties($$).name, properties($$).age, properties(edge).likeness"; + String query = "GO FROM \"Bob\" OVER like " + "YIELD $$.person.name, $$.person.age, like.likeness"; ResultSet resp = session.execute(query); printResult(resp); }finally { 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 127ba504a05..8f6a7d30227 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 @@ -324,15 +324,14 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * Filter the players that the player with VID `player100` follows whose age is equal to or greater than 35. Rename the corresponding columns in the results with `Teammate` and `Age`. ```ngql - nebula> GO FROM "player100" OVER follow WHERE properties($$).age >= 35 \ - YIELD properties($$).name AS Teammate, properties($$).age AS Age; - +-----------------+-----+ - | Teammate | Age | - +-----------------+-----+ - | "Tony Parker" | 36 | - +-----------------+-----+ - | "Manu Ginobili" | 41 | - +-----------------+-----+ + nebula> GO FROM "player100" OVER follow WHERE $$.player.age >= 35 \ + YIELD $$.player.name AS Teammate, $$.player.age AS Age; + +---------------+-----+ + | Teammate | Age | + +---------------+-----+ + | "Tony Parker" | 36 | + +---------------+-----+ + Got 1 rows (time spent 8206/9335 us) ``` |Clause/Sign|Description| @@ -346,18 +345,15 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * With a pipe: ```ngql - nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ - GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ - properties($^).name AS Player; - +-----------+-----------------+ - | Team | Player | - +-----------+-----------------+ - | "Spurs" | "Tony Parker" | - +-----------+-----------------+ - | "Hornets" | "Tony Parker" | - +-----------+-----------------+ - | "Spurs" | "Manu Ginobili" | - +-----------+-----------------+ + nebula> GO FROM "player100" OVER follow YIELD follow._dst AS id | \ + GO FROM $-.id OVER serve YIELD $$.team.name AS Team, \ + $^.player.name AS Player; + +-----------+---------------+ + | Team | Player | + +-----------+---------------+ + | "Nuggets" | "Tony Parker" | + +-----------+---------------+ + Got 1 rows (time spent 5055/8203 us) ``` |Clause/Sign|Description| @@ -373,18 +369,15 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi Once a composite statement is submitted to the server as a whole, the life cycle of the temporary variables in the statement ends. ```ngql - nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ - GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ - properties($^).name AS Player; - +-----------+-----------------+ - | Team | Player | - +-----------+-----------------+ - | "Spurs" | "Tony Parker" | - +-----------+-----------------+ - | "Hornets" | "Tony Parker" | - +-----------+-----------------+ - | "Spurs" | "Manu Ginobili" | - +-----------+-----------------+ + nebula> $var = GO FROM "player100" OVER follow YIELD follow._dst AS id; \ + GO FROM $var.id OVER serve YIELD $$.team.name AS Team, \ + $^.player.name AS Player; + +---------+-------------+ + | Team | Player | + +---------+-------------+ + | Nuggets | Tony Parker | + +---------+-------------+ + Got 1 rows (time spent 3103/3711 us) ``` ### Example of `FETCH` statement @@ -398,6 +391,7 @@ nebula> FETCH PROP ON player "player100"; +----------------------------------------------------+ | ("player100" :player{age: 42, name: "Tim Duncan"}) | +----------------------------------------------------+ +Got 1 rows (time spent 2006/2406 us) ``` !!! Note 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 28217d2fc4e..3f87dcf5f04 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 @@ -153,8 +153,8 @@ Feature: Comparison of where clause When profiling query: """ GO FROM "player100" OVER follow - WHERE properties(edge).degree IN [v IN [95,99] WHERE v > 0] - YIELD dst(edge), properties(edge).degree + WHERE follow.degree IN [v IN [95,99] WHERE v > 0] + YIELD follow._dst, follow.degree """ Then the result should be, in any order: | follow._dst | follow.degree | @@ -163,7 +163,7 @@ Feature: Comparison of where clause And the execution plan should be: | id | name | dependencies | operator info | | 0 | Project | 1 | | - | 1 | GetNeighbors | 2 | {"filter": "(properties(edge).degree IN [v IN [95,99] WHERE (v>0)])"} | + | 1 | GetNeighbors | 2 | {"filter": "(follow.degree IN [v IN [95,99] WHERE (v>0)])"} | | 2 | Start | | | ``` diff --git a/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md b/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md index 889f0c4cefd..f9ab9fed1e0 100644 --- a/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md +++ b/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md @@ -13,7 +13,7 @@ nGQL does not have strict formatting requirements, but creating nGQL statements Not recommended: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id; + GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id; ``` Recommended: @@ -21,7 +21,7 @@ nGQL does not have strict formatting requirements, but creating nGQL statements ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD src(edge) AS id; + YIELD follow._dst AS id; ``` 2. Start a new line to write different statements in a composite statement. @@ -29,8 +29,8 @@ nGQL does not have strict formatting requirements, but creating nGQL statements Not recommended: ```ngql - 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; + GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id | GO FROM $-.id \ + OVER serve WHERE $^.player.age > 20 YIELD $^.player.name AS FriendOf, $$.team.name AS Team; ``` Recommended: @@ -38,10 +38,10 @@ nGQL does not have strict formatting requirements, but creating nGQL statements ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD src(edge) AS id | \ + YIELD follow._dst AS id | \ GO FROM $-.id OVER serve \ - WHERE properties($^).age > 20 \ - YIELD properties($^).name AS FriendOf, properties($$).name AS Team; + WHERE $^.player.age > 20 \ + YIELD $^.player.name AS FriendOf, $$.team.name AS Team; ``` 3. If the clause exceeds 80 characters, start a new line at the appropriate place. @@ -218,10 +218,10 @@ The strings should be surrounded by double quotes. ```ngql GO FROM "player100" \ OVER follow \ - YIELD dst(edge) AS id; | \ + YIELD follow._dst AS id; | \ GO FROM $-.id \ OVER serve \ - YIELD properties($$).name AS Team, properties($^).name AS Player; + YIELD $$.team.name AS Team, $^.player.name AS Player; ``` Supported: @@ -229,10 +229,10 @@ The strings should be surrounded by double quotes. ```ngql GO FROM "player100" \ OVER follow \ - YIELD dst(edge) AS id | \ + YIELD follow._dst AS id | \ GO FROM $-.id \ OVER serve \ - YIELD properties($$).name AS Team, properties($^).name AS Player; + YIELD $$.team.name AS Team, $^.player.name AS Player; ``` 3. In a composite statement that contains user-defined variables, use an English semicolon to end the statements that define the variables. If you do not follow the rules to add a semicolon or use a pipe to end the composite statement, the execution will fail. diff --git a/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md b/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md index 6b7ff3b3626..32c95ba8003 100644 --- a/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md +++ b/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md @@ -27,7 +27,7 @@ nebula> DELETE VERTEX "team1"; This query shows that you can use `DELETE VERTEX` together with pipe to delete vertices. ```ngql -nebula> GO FROM "player100" OVER serve WHERE properties(edge).start_year == "2021" YIELD dst(edge) AS id | DELETE VERTEX $-.id; +nebula> GO FROM "player100" OVER serve WHERE serve.start_year == "2021" YIELD serve._dst AS id | DELETE VERTEX $-.id; ``` ## Delete the process and the related edges diff --git a/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md index 6a681d62256..053050759a3 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md @@ -31,7 +31,7 @@ The following example checks the properties of the edge with the GO statement. ```ngql nebula> GO FROM "player100" \ OVER serve \ - YIELD properties(edge).start_year, properties(edge).end_year; + YIELD serve.start_year, serve.end_year; +------------------+----------------+ | serve.start_year | serve.end_year | +------------------+----------------+ diff --git a/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md index 3373baeaa92..07966f5d598 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md @@ -24,7 +24,7 @@ The following example shows that you can use `DELETE EDGE` together with pipe op ```ngql nebula> GO FROM "player100" OVER follow \ - WHERE dst(edge) == "team204" \ - YIELD src(edge) AS src, dst(edge) AS dst, rank(edge) AS rank \ + WHERE follow._dst == "team204" \ + YIELD follow._src AS src, follow._dst AS dst, follow._rank AS rank \ | DELETE EDGE follow $-.src->$-.dst @ $-.rank; ``` diff --git a/docs-2.0/3.ngql-guide/3.data-types/6.list.md b/docs-2.0/3.ngql-guide/3.data-types/6.list.md index 8018a3939fa..750c826c95e 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/6.list.md +++ b/docs-2.0/3.ngql-guide/3.data-types/6.list.md @@ -180,8 +180,8 @@ nebula> RETURN size([1,2,3]); +---------------+ # The following query calculates the elements in the list [92,90] and runs a conditional judgment in a where clause. -nebula> GO FROM "player100" OVER follow WHERE properties(edge).degree NOT IN [x IN [92, 90] | x + $$.player.age] \ - YIELD dst(edge) AS id, properties(edge).degree AS degree; +nebula> GO FROM "player100" OVER follow WHERE follow.degree NOT IN [x IN [92, 90] | x + $$.player.age] \ + YIELD follow._dst AS id, follow.degree AS degree; +-------------+--------+ | id | degree | +-------------+--------+ diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md index 8ed7ef39b82..b72b3bb6dee 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md @@ -58,16 +58,12 @@ For example, a query is composed of three sub-queries: `A B C`, `A | B | C` or ` ```ngql # Connect multiple queries with pipes. - nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ - GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ - properties($^).name AS Player; - +-----------+-----------------+ - | Team | Player | - +-----------+-----------------+ - | "Spurs" | "Tony Parker" | - +-----------+-----------------+ - | "Hornets" | "Tony Parker" | - +-----------+-----------------+ - | "Spurs" | "Manu Ginobili" | - +-----------+-----------------+ + nebula> GO FROM "player100" OVER follow YIELD follow._dst AS id | \ + GO FROM $-.id OVER serve YIELD $$.team.name AS Team, \ + $^.player.name AS Player; + +---------+-------------+ + | Team | Player | + +---------+-------------+ + | Nuggets | Tony Parker | + +---------+-------------+ ``` diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md index 7e4cd05c410..f9c0ec5dce8 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md @@ -32,16 +32,12 @@ You can use user-defined variables in composite queries. Details about composite ## Example ```ngql -nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ - GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ - properties($^).name AS Player; -+-----------+-----------------+ -| Team | Player | -+-----------+-----------------+ -| "Spurs" | "Tony Parker" | -+-----------+-----------------+ -| "Hornets" | "Tony Parker" | -+-----------+-----------------+ -| "Spurs" | "Manu Ginobili" | -+-----------+-----------------+ +nebula> $var = GO FROM "player100" OVER follow YIELD follow._dst AS id; \ + GO FROM $var.id OVER serve YIELD $$.team.name AS Team, \ + $^.player.name AS Player; ++---------+-------------+ +| Team | Player | ++---------+-------------+ +| Nuggets | Tony Parker | ++---------+-------------+ ``` diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md index e877cbc658b..bf329c5124e 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md @@ -61,7 +61,7 @@ Apart from the user-defined edge property, there are four built-in properties in The following query returns the `name` property of the `player` tag on the source vertex and the `age` property of the `player` tag on the destination vertex. ```ngql -nebula> GO FROM "player100" OVER follow YIELD properties($^).name AS startName, properties($$).age AS endAge; +nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.player.age AS endAge; +--------------+--------+ | startName | endAge | +--------------+--------+ @@ -74,7 +74,7 @@ nebula> GO FROM "player100" OVER follow YIELD properties($^).name AS startName, The following query returns the `degree` property of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD properties(edge).degree; +nebula> GO FROM "player100" OVER follow YIELD follow.degree; +---------------+ | follow.degree | +---------------+ @@ -87,12 +87,12 @@ nebula> GO FROM "player100" OVER follow YIELD properties(edge).degree; The following query returns the source vertex, the destination vertex, the edge type, and the edge rank value of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD src(edge), dst(edge), type(edge), rank(edge); -+-------------+-------------+------------+------------+ -| src(EDGE) | dst(EDGE) | type(EDGE) | rank(EDGE) | -+-------------+-------------+------------+------------+ -| "player100" | "player101" | "follow" | 0 | -+-------------+-------------+------------+------------+ -| "player100" | "player125" | "follow" | 0 | -+-------------+-------------+------------+------------+ +nebula> GO FROM "player100" OVER follow YIELD follow._src, follow._dst, follow._type, follow._rank; ++-------------+-------------+--------------+--------------+ +| follow._src | follow._dst | follow._type | follow._rank | ++-------------+-------------+--------------+--------------+ +| "player100" | "player101" | 136 | 0 | ++-------------+-------------+--------------+--------------+ +| "player100" | "player102" | 136 | 0 | ++-------------+-------------+--------------+--------------+ ``` diff --git a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md index 9b634f51a21..aabee9ac329 100644 --- a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md +++ b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md @@ -190,15 +190,13 @@ nebula> RETURN "a" IS NOT EMPTY; | true | +------------------+ -nebula> GO FROM "player100" OVER * WHERE properties($$).name IS NOT EMPTY YIELD dst(edge); +nebula> GO FROM "player100" OVER * WHERE $$.player.name IS NOT EMPTY YIELD follow._dst; +-------------+ -| dst(EDGE) | +| follow._dst | +-------------+ -| "team204" | +| "player125" | +-------------+ | "player101" | +-------------+ -| "player125" | -+-------------+ ``` diff --git a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md index 99df7df1ed0..686afe14187 100644 --- a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md +++ b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md @@ -18,7 +18,7 @@ One major difference between nGQL and SQL is how sub-queries are composed. ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD dst(edge) AS dstid, properties($$).name AS Name | \ + YIELD follow._dst AS dstid, $$.player.name AS Name | \ GO FROM $-.dstid OVER follow; +-------------+ @@ -26,7 +26,6 @@ nebula> GO FROM "player100" OVER follow \ +-------------+ | "player101" | +-------------+ -|... | ``` If there is no `YIELD` clause to define the output, the destination vertex ID is returned by default. If a YIELD clause is applied, the output is defined by the YIELD clause. diff --git a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md index ee25735a540..7636c079fe8 100644 --- a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md +++ b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md @@ -18,7 +18,7 @@ Reference operators apply to native nGQL only. ```ngql # The following example returns the age of the source vertex and the destination vertex. -nebula> GO FROM "player100" OVER follow YIELD properties($^).age AS SrcAge, properties($$).age AS DestAge; +nebula> GO FROM "player100" OVER follow YIELD $^.player.age AS SrcAge, $$.player.age AS DestAge; +--------+---------+ | SrcAge | DestAge | +--------+---------+ @@ -29,9 +29,9 @@ nebula> GO FROM "player100" OVER follow YIELD properties($^).age AS SrcAge, prop # The following example returns the name and team of the players that player100 follows. nebula> GO FROM "player100" OVER follow \ - YIELD dst(edge) AS id | \ + YIELD follow._dst AS id | \ GO FROM $-.id OVER serve \ - YIELD $^.player.name AS Player, properties($$).name AS Team; + YIELD $^.player.name AS Player, $$.team.name AS Team; +-----------------+-----------+ | Player | Team | +-----------------+-----------+ diff --git a/docs-2.0/3.ngql-guide/5.operators/6.set.md b/docs-2.0/3.ngql-guide/5.operators/6.set.md index 7c863446ee6..8f733911ad5 100644 --- a/docs-2.0/3.ngql-guide/5.operators/6.set.md +++ b/docs-2.0/3.ngql-guide/5.operators/6.set.md @@ -28,7 +28,7 @@ nebula> GO FROM "player102" OVER follow \ UNION \ GO FROM "player100" OVER follow; +-------------+ -| dst(edge) | +| follow._dst | +-------------+ | "player101" | +-------------+ @@ -40,7 +40,7 @@ nebula> GO FROM "player102" OVER follow \ UNION ALL \ GO FROM "player100" OVER follow; +-------------+ -| dst(edge) | +| follow._dst | +-------------+ | "player101" | +-------------+ @@ -51,20 +51,18 @@ nebula> GO FROM "player102" OVER follow \ # UNION can also work with the YIELD statement. The DISTINCT keyword will check duplication by all the columns for every line, and remove duplicated lines if every column is the same. nebula> GO FROM "player102" OVER follow \ - YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age \ + YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age \ UNION /* DISTINCT */ \ GO FROM "player100" OVER follow \ - YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; + YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age; +-------------+--------+-----+ | id | Degree | Age | +-------------+--------+-----+ -| "player100" | 75 | 42 | +| "player101" | 75 | 36 | +-------------+--------+-----+ -| "player101" | 75 | 36 | +| "player101" | 96 | 36 | +-------------+--------+-----+ -| "player101" | 95 | 36 | -+-------------+--------+-----+ -| "player125" | 95 | 41 | +| "player102" | 90 | 33 | +-------------+--------+-----+ ``` @@ -82,10 +80,10 @@ nebula> GO FROM "player102" OVER follow \ ```ngql nebula> GO FROM "player102" OVER follow \ - YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age \ + YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age \ INTERSECT \ GO FROM "player100" OVER follow \ - YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; + YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age; Empty set (time spent 2990/3511 us) ``` @@ -104,7 +102,7 @@ nebula> GO FROM "player100" OVER follow \ MINUS \ GO FROM "player102" OVER follow; +-------------+ -| dst(edge) | +| follow._dst | +-------------+ | "player102" | +-------------+ @@ -123,22 +121,18 @@ Please note that when a query contains a pipe `|` and a set operator, the pipe t ```ngql nebula> GO FROM "player102" OVER follow \ - YIELD dst(edge) AS play_dst \ + YIELD follow._dst AS play_dst \ UNION \ GO FROM "team200" OVER serve REVERSELY \ - YIELD src(edge) AS play_src \ - | GO FROM $-.play_src OVER follow YIELD dst(edge) AS play_dst; + YIELD serve._dst AS play_dst \ + | GO FROM $-.play_dst OVER follow YIELD follow._dst AS play_dst; +-------------+ | play_dst | +-------------+ -| "player100" | -+-------------+ | "player101" | +-------------+ -| "player117" | -+-------------+ -| "player105" | +| "player102" | +-------------+ ``` @@ -150,11 +144,11 @@ The parentheses can change the execution priority. For example: ```ngql nebula> (GO FROM "player102" OVER follow \ - YIELD dst(edge) AS play_dst \ + YIELD follow._dst AS play_dst \ UNION \ GO FROM "team200" OVER serve REVERSELY \ - YIELD src(edge) AS play_dst) \ - | GO FROM $-.play_dst OVER follow YIELD dst(edge) AS play_dst; + YIELD serve._dst AS play_dst) \ + | GO FROM $-.play_dst OVER follow YIELD follow._dst AS play_dst; ``` In the above query, the statements within the parentheses take precedence. That is, the `UNION` operation will be executed first, and its output will be executed as the input of the next operation with pipes. diff --git a/docs-2.0/3.ngql-guide/5.operators/7.string.md b/docs-2.0/3.ngql-guide/5.operators/7.string.md index a7be0a24c7d..563b8fa26f1 100644 --- a/docs-2.0/3.ngql-guide/5.operators/7.string.md +++ b/docs-2.0/3.ngql-guide/5.operators/7.string.md @@ -47,19 +47,19 @@ nebula> MATCH (s:player)-[e:serve]->(t:team) WHERE id(s) == "player101" \ | "Tony Parker" | 2018 | 2019 | "Hornets" | +---------------+--------------+------------+-----------+ -nebula> GO FROM "player101" OVER serve WHERE (STRING)properties(edge).start_year CONTAINS "19" AND \ - properties($^).name CONTAINS "ny" \ - YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name; +nebula> GO FROM "player101" OVER serve WHERE (STRING)serve.start_year CONTAINS "19" AND \ + $^.player.name CONTAINS "ny" \ + YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name; +----------------+------------------+----------------+--------------+ -| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | +| $^.player.name | serve.start_year | serve.end_year | $$.team.name | +----------------+------------------+----------------+--------------+ | "Tony Parker" | 1999 | 2018 | "Spurs" | +----------------+------------------+----------------+--------------+ -nebula> GO FROM "player101" OVER serve WHERE !(properties($$).name CONTAINS "ets") \ - YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, $$.team.name; +nebula> GO FROM "player101" OVER serve WHERE !($$.team.name CONTAINS "ets") \ + YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name; +----------------+------------------+----------------+--------------+ -| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | +| $^.player.name | serve.start_year | serve.end_year | $$.team.name | +----------------+------------------+----------------+--------------+ | "Tony Parker" | 1999 | 2018 | "Spurs" | +----------------+------------------+----------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md index c3de8c36958..a033a07037d 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md @@ -53,18 +53,18 @@ double radians() | Converts degrees to radians. `radians(180)` returns `3.141592 ```ngql # The following statement supports aggregate functions. -nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS dst, properties($$).age AS age \ +nebula> GO FROM "Tim Duncan" OVER like YIELD like._dst AS dst, $$.player.age AS age \ | GROUP BY $-.dst \ YIELD \ $-.dst AS dst, \ toInteger((sum($-.age)/count($-.age)))+avg(distinct $-.age+1)+1 AS statistics; -+-------------+------------+ -| dst | statistics | -+-------------+------------+ -| "player125" | 84.0 | -+-------------+------------+ -| "player101" | 74.0 | -+-------------+------------+ ++-----------------+------------+ +| dst | statistics | ++-----------------+------------+ +| "Tony Parker" | 74.0 | ++-----------------+------------+ +| "Manu Ginobili" | 84.0 | ++-----------------+------------+ Got 2 rows (time spent 4739/5064 us) ``` diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md index 194ff32817d..52f82fb4be8 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md @@ -64,8 +64,8 @@ nebula> MATCH p = (n:player{name:"LeBron James"})<-[:follow]-(m) \ nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ | GO FROM $-.VertexID over follow \ - WHERE properties(edge).degree != reduce(totalNum = 5, n IN range(1, 3) | properties($$).age + totalNum + n) \ - YIELD properties($$).name AS id, properties($$).age AS age, properties(edge).degree AS degree; + WHERE follow.degree != reduce(totalNum = 5, n IN range(1, 3) | $$.player.age + totalNum + n) \ + YIELD $$.player.name AS id, $$.player.age AS age, follow.degree AS degree; +---------------------+-----+--------+ | id | age | degree | +---------------------+-----+--------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md index e7d285feed4..7be8e392f96 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md @@ -36,7 +36,7 @@ nebula> RETURN concat("1","2",NULL) AS r; +----------+ nebula> GO FROM "player100" over follow \ - YIELD concat(src(edge), properties($^).age, properties($$).name, properties(edge).degree) AS A; + YIELD concat(follow._src, $^.player.age, $$.player.name, follow.degree) AS A; +------------------------------+ | A | +------------------------------+ @@ -98,7 +98,7 @@ nebula> RETURN concat_ws("+","a") AS r; +-----+ nebula> GO FROM "player100" over follow \ - YIELD concat_ws(" ",src(edge), properties($^).age, properties($$).name, properties(edge).degree) AS A; + YIELD concat_ws(" ",follow._src, $^.player.age, $$.player.name, follow.degree) AS A; +---------------------------------+ | A | +---------------------------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md index 2dc2ac22d5b..1cb222df372 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md @@ -46,20 +46,20 @@ nebula> RETURN \ ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD properties($$).name AS Name, \ - CASE properties($$).age > 35 \ + YIELD $$.player.name AS Name, \ + CASE $$.player.age > 35 \ WHEN true THEN "Yes" \ WHEN false THEN "No" \ ELSE "Nah" \ END \ AS Age_above_35; -+-----------------+--------------+ -| Name | Age_above_35 | -+-----------------+--------------+ -| "Tony Parker" | "Yes" | -+-----------------+--------------+ -| "Manu Ginobili" | "Yes" | -+-----------------+--------------+ ++---------------------+--------------+ +| Name | Age_above_35 | ++---------------------+--------------+ +| "Tony Parker" | "Yes" | ++---------------------+--------------+ +| "LaMarcus Aldridge" | "No" | ++---------------------+--------------+ ``` ## The generic form of CASE expressions @@ -121,9 +121,9 @@ To avoid the misuse of the simple form and the generic form, it is important to ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD properties($$).name AS Name, properties($$).age AS Age, \ - CASE properties($$).age \ - WHEN properties($$).age > 35 THEN "Yes" \ + YIELD $$.player.name AS Name, $$.player.age AS Age, \ + CASE $$.player.age \ + WHEN $$.player.age > 35 THEN "Yes" \ ELSE "No" \ END \ AS Age_above_35; diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md index 7bafb8bd4b8..663fd048ea7 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md @@ -33,7 +33,7 @@ nebula> WITH [NULL, 1, 1, 2, 2] As a UNWIND a AS b \ ```ngql # The statement in the following example searches for the people whom `player101` follows and people who follow `player101`, i.e. a bidirectional query. nebula> GO FROM "player101" OVER follow BIDIRECT \ - YIELD properties($$).name AS Name \ + YIELD $$.player.name AS Name \ | GROUP BY $-.Name YIELD $-.Name, count(*); +---------------------+----------+ | $-.Name | count(*) | diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md index 5c5d858b996..5e56cac9f5d 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md @@ -156,12 +156,12 @@ Use a `YIELD` clause to fetch specific properties of an edge. ```ngql nebula> FETCH PROP ON serve "player100" -> "team204" \ - YIELD properties(edge).start_year; -+-------------+------------+-------------+-----------------------------+ -| serve._src | serve._dst | serve._rank | properties(EDGE).start_year | -+-------------+------------+-------------+-----------------------------+ -| "player100" | "team204" | 0 | 1997 | -+-------------+------------+-------------+-----------------------------+ + YIELD serve.start_year; ++-------------+------------+-------------+------------------+ +| serve._src | serve._dst | serve._rank | serve.start_year | ++-------------+------------+-------------+------------------+ +| "player100" | "team204" | 0 | 1997 | ++-------------+------------+-------------+------------------+ ``` ### Fetch properties of multiple edges @@ -216,36 +216,36 @@ The following statement returns the `degree` values of the `follow` edges that s ```ngql nebula> GO FROM "player101" OVER follow \ - YIELD src(edge) AS s, dst(edge) AS d \ - | FETCH PROP ON follow $-.s -> $-.d \ - YIELD properties(edge).degree; -+-------------+-------------+--------------+-------------------------+ -| follow._src | follow._dst | follow._rank | properties(EDGE).degree | -+-------------+-------------+--------------+-------------------------+ -| "player101" | "player100" | 0 | 95 | -+-------------+-------------+--------------+-------------------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+--------------+-------------------------+ -| "player101" | "player125" | 0 | 95 | -+-------------+-------------+--------------+-------------------------+ + YIELD follow._src AS s, follow._dst AS d |\ + FETCH PROP ON follow $-.s -> $-.d \ + YIELD follow.degree; ++-------------+-------------+--------------+---------------+ +| follow._src | follow._dst | follow._rank | follow.degree | ++-------------+-------------+--------------+---------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+---------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+---------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+---------------+ ``` Or you can use user-defined variables to construct similar queries. ```ngql nebula> $var = GO FROM "player101" OVER follow \ - YIELD src(edge) AS s, dst(edge) AS d; \ + YIELD follow._src AS s, follow._dst AS d; \ FETCH PROP ON follow $var.s -> $var.d \ - YIELD properties(edge).degree; -+-------------+-------------+--------------+-------------------------+ -| follow._src | follow._dst | follow._rank | properties(EDGE).degree | -+-------------+-------------+--------------+-------------------------+ -| "player101" | "player100" | 0 | 95 | -+-------------+-------------+--------------+-------------------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+--------------+-------------------------+ -| "player101" | "player125" | 0 | 95 | -+-------------+-------------+--------------+-------------------------+ + YIELD follow.degree; ++-------------+-------------+--------------+---------------+ +| follow._src | follow._dst | follow._rank | follow.degree | ++-------------+-------------+--------------+---------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+---------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+---------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+---------------+ ``` For more information about composite queries, see [Composite queries (clause structure)](../4.variable-and-composite-queries/1.composite-queries.md). diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md index 07259f017f1..54700afbc1f 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md @@ -86,7 +86,7 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name == "Tony Parker" \ - YIELD properties(vertex).name AS name, properties(vertex).age AS age; + YIELD player.name AS name, player.age AS age; +-------------+---------------+-----+ | VertexID | name | age | +-------------+---------------+-----+ @@ -106,20 +106,20 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name STARTS WITH "B" \ AND player.age IN [22,30] \ - YIELD properties(vertex).name, properties(vertex).age; -+-------------+-------------------------+------------------------+ -| VertexID | properties(VERTEX).name | properties(VERTEX).age | -+-------------+-------------------------+------------------------+ -| "player149" | "Ben Simmons" | 22 | -+-------------+-------------------------+------------------------+ -| "player134" | "Blake Griffin" | 30 | -+-------------+-------------------------+------------------------+ + YIELD player.name, player.age; ++-------------+-----------------+------------+ +| VertexID | player.name | player.age | ++-------------+-----------------+------------+ +| "player149" | "Ben Simmons" | 22 | ++-------------+-----------------+------------+ +| "player134" | "Blake Griffin" | 30 | ++-------------+-----------------+------------+ nebula> LOOKUP ON player \ WHERE player.name == "Kobe Bryant" \ - YIELD properties(vertex).name AS name |\ + YIELD player.name AS name |\ GO FROM $-.VertexID OVER serve \ - YIELD $-.name, properties(edge).start_year, properties(edge).end_year, properties($$).name; + YIELD $-.name, serve.start_year, serve.end_year, $$.team.name; +---------------+------------------+----------------+--------------+ | $-.name | serve.start_year | serve.end_year | $$.team.name | +---------------+------------------+----------------+--------------+ @@ -156,23 +156,23 @@ nebula> LOOKUP ON follow \ nebula> LOOKUP ON follow \ WHERE follow.degree == 90 \ - YIELD properties(edge).degree; -+-------------+-------------+---------+-------------------------+ -| SrcVID | DstVID | Ranking | properties(EDGE).degree | -+-------------+-------------+---------+-------------------------+ -| "player121" | "player116" | 0 | 90 | -+-------------+-------------+---------+-------------------------+ -| "player121" | "player128" | 0 | 90 | -+-------------+-------------+---------+-------------------------+ -| "player121" | "player129" | 0 | 90 | -+-------------+-------------+---------+-------------------------+ + YIELD follow.degree; ++-------------+-------------+---------+---------------+ +| SrcVID | DstVID | Ranking | follow.degree | ++-------------+-------------+---------+---------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+---------+---------------+ +| "player133" | "player114" | 0 | 90 | ++-------------+-------------+---------+---------------+ +| "player133" | "player144" | 0 | 90 | ++-------------+-------------+---------+---------------+ ... nebula> LOOKUP ON follow \ WHERE follow.degree == 60 \ - YIELD properties(edge).degree AS Degree |\ + YIELD follow.degree AS Degree |\ GO FROM $-.DstVID OVER serve \ - YIELD $-.DstVID, properties(edge).start_year, properties(edge).end_year, properties($$).name; + YIELD $-.DstVID, serve.start_year, serve.end_year, $$.team.name; +-------------+------------------+----------------+--------------+ | $-.DstVID | serve.start_year | serve.end_year | $$.team.name | +-------------+------------------+----------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md index 4461785baa3..7d2b2cafaab 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md @@ -44,7 +44,7 @@ The following statement finds all the vertices connected directly to vertex `"pl ```ngql nebula> GO FROM "player100" OVER follow BIDIRECT \ - YIELD properties($$).name as Name \ + YIELD $$.player.name as Name \ | GROUP BY $-.Name \ YIELD $-.Name as Player, count(*) AS Name_Count; +---------------------+------------+ @@ -78,7 +78,7 @@ The following statement finds all the vertices connected directly to vertex `"pl ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD src(edge) AS player, properties(edge).degree AS degree \ + YIELD follow._src AS player, follow.degree AS degree \ | GROUP BY $-.player \ YIELD sum($-.degree); +----------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md index a908352526c..e758cb399ae 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md @@ -30,7 +30,7 @@ YIELD ```ngql # The following example returns the 3 rows of data starting from the second row of the sorted output. nebula> GO FROM "player100" OVER follow REVERSELY \ - YIELD properties($$).name AS Friend, properties($$).age AS Age \ + YIELD $$.player.name AS Friend, $$.player.age AS Age \ | ORDER BY $-.Age, $-.Friend \ | LIMIT 1, 3; +-------------------+-----+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md index b3802c973a8..ba985a54ef5 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md @@ -41,7 +41,7 @@ nebula> FETCH PROP ON player "player100", "player101", "player102", "player103" +-------------+-----+---------------------+ nebula> $var = GO FROM "player100" OVER follow \ - YIELD dst(edge) AS dst; \ + YIELD follow._dst AS dst; \ ORDER BY $var.dst DESC; +-------------+ | dst | diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md index 0dcb4dcc9cc..f32c521bfd1 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md @@ -48,15 +48,16 @@ nebula> MATCH (v:player) \ ```ngql nebula> GO FROM "player100" \ OVER follow \ - WHERE properties(edge).degree > 90 \ - OR properties($$).age != 33 \ - AND properties($$).name != "Tony Parker" \ - YIELD properties($$); -+----------------------------------+ -| properties($$) | -+----------------------------------+ -| {age: 41, name: "Manu Ginobili"} | -+----------------------------------+ + WHERE follow.degree > 90 \ + OR $$.player.age != 33 \ + AND $$.player.name != "Tony Parker"; ++-------------+ +| follow._dst | ++-------------+ +| "player101" | ++-------------+ +| "player125" | ++-------------+ ``` ### Filter on properties @@ -179,20 +180,20 @@ nebula> INSERT EDGE e1(p1) VALUES "1"->"2"@6:(16); # The following example use rank to filter edges and retrieves edges with a rank greater than 2. nebula> GO FROM "1" \ OVER e1 \ - WHERE rank(edge) > 2 \ - YIELD src(edge), dst(edge), rank(edge) AS Rank, properties(edge).p1 | \ + WHERE e1._rank>2 \ + YIELD e1._src, e1._dst, e1._rank AS Rank, e1.p1 | \ ORDER BY $-.Rank DESC; -+-----------+-----------+------+---------------------+ -| src(EDGE) | dst(EDGE) | Rank | properties(EDGE).p1 | -+-----------+-----------+------+---------------------+ -| "1" | "2" | 6 | 16 | -+-----------+-----------+------+---------------------+ -| "1" | "2" | 5 | 15 | -+-----------+-----------+------+---------------------+ -| "1" | "2" | 4 | 14 | -+-----------+-----------+------+---------------------+ -| "1" | "2" | 3 | 13 | -+-----------+-----------+------+---------------------+ +==================================== +| e1._src | e1._dst | Rank | e1.p1 | +==================================== +| 1 | 2 | 6 | 16 | +------------------------------------ +| 1 | 2 | 5 | 15 | +------------------------------------ +| 1 | 2 | 4 | 14 | +------------------------------------ +| 1 | 2 | 3 | 13 | +------------------------------------ ``` ## Filter on strings @@ -339,20 +340,20 @@ nebula> MATCH (v:player) \ | "Joel Embiid" | 25 | +-------------------------+-------+ -nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD properties(vertex).name, properties(vertex).age; -+-------------+-------------------------+------------------------+ -| VertexID | properties(VERTEX).name | properties(VERTEX).age | -+-------------+-------------------------+------------------------+ -| "player106" | "Kyle Anderson" | 25 | -+-------------+-------------------------+------------------------+ -| "player135" | "Damian Lillard" | 28 | -+-------------+-------------------------+------------------------+ -| "player130" | "Joel Embiid" | 25 | -+-------------+-------------------------+------------------------+ -| "player131" | "Paul George" | 28 | -+-------------+-------------------------+------------------------+ -| "player123" | "Ricky Rubio" | 28 | -+-------------+-------------------------+------------------------+ +nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD player.name, player.age; ++-------------+------------------+------------+ +| VertexID | player.name | player.age | ++-------------+------------------+------------+ +| "player135" | "Damian Lillard" | 28 | ++-------------+------------------+------------+ +| "player131" | "Paul George" | 28 | ++-------------+------------------+------------+ +| "player130" | "Joel Embiid" | 25 | ++-------------+------------------+------------+ +| "player123" | "Ricky Rubio" | 28 | ++-------------+------------------+------------+ +| "player106" | "Kyle Anderson" | 25 | ++-------------+------------------+------------+ ``` ### Match values not in a list diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md index 11fa3226d7f..86ae171dc75 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md @@ -71,7 +71,7 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...]; ```ngql nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ - YIELD properties(vertex).name, properties(vertex).age; + YIELD player.name, player.age; ======================================= | VertexID | player.name | player.age | ======================================= diff --git a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md index a9500b8513d..fb76c49a09d 100644 --- a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md +++ b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md @@ -31,7 +31,7 @@ To query edge data on the **Console** page and then view the result on the **Exp Here is an nGQL statement example. ```ngql - nebula> GO FROM "player102" OVER serve YIELD src(edge),dst(edge); + nebula> GO FROM "player102" OVER serve YIELD serve._src,serve._dst; ``` In the query result, you can see the start year and end year of the service team for the player whose playerId is `palyer102`. As shown below. From 57e4afc97701734d89fa6018a69374e148f984dc Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:40:31 +0800 Subject: [PATCH 3/7] Revert "command changes in batch" This reverts commit 812704288aa1a8c7c3cdebb7109cb77707ce9adf. --- .../3.graph-service.md | 8 +- docs-2.0/14.client/4.nebula-java-client.md | 2 +- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 60 ++++++++------- .../1.nGQL-overview/1.overview.md | 6 +- .../1.nGQL-overview/ngql-style-guide.md | 22 +++--- .../12.vertex-statements/4.delete-vertex.md | 2 +- .../13.edge-statements/2.update-edge.md | 2 +- .../13.edge-statements/4.delete-edge.md | 4 +- docs-2.0/3.ngql-guide/3.data-types/6.list.md | 4 +- .../1.composite-queries.md | 20 +++-- .../2.user-defined-variables.md | 20 +++-- .../3.property-reference.md | 20 ++--- .../3.ngql-guide/5.operators/1.comparison.md | 8 +- docs-2.0/3.ngql-guide/5.operators/4.pipe.md | 3 +- .../5.operators/5.property-reference.md | 6 +- docs-2.0/3.ngql-guide/5.operators/6.set.md | 40 +++++----- docs-2.0/3.ngql-guide/5.operators/7.string.md | 14 ++-- .../6.functions-and-expressions/1.math.md | 16 ++-- .../6.functions-and-expressions/11.reduce.md | 4 +- .../6.functions-and-expressions/13.concat.md | 4 +- .../5.case-expressions.md | 24 +++--- .../6.functions-and-expressions/7.count.md | 2 +- .../7.general-query-statements/4.fetch.md | 58 +++++++-------- .../7.general-query-statements/5.lookup.md | 46 ++++++------ .../8.clauses-and-options/group-by.md | 4 +- .../8.clauses-and-options/limit.md | 2 +- .../8.clauses-and-options/order-by.md | 2 +- .../8.clauses-and-options/where.md | 73 +++++++++---------- .../8.clauses-and-options/yield.md | 2 +- .../use-console/st-ug-open-in-explore.md | 2 +- 30 files changed, 251 insertions(+), 229 deletions(-) diff --git a/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md b/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md index 6ff3b73f000..c1a34bf1174 100644 --- a/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md +++ b/docs-2.0/1.introduction/3.nebula-graph-architecture/3.graph-service.md @@ -20,7 +20,7 @@ After a query is sent to Graph Service, it will be processed by the following fo After receiving a request, the statements will be parsed by the Parser composed of Flex (lexical analysis tool) and Bison (syntax analysis tool), and its corresponding AST will be generated. Statements will be directly intercepted in this stage because of its invalid syntax. -For example, the structure of the AST of `GO FROM "Tim" OVER like WHERE like.likeness > 8.0 YIELD like._dst` is shown in the following picture. +For example, the structure of the AST of `GO FROM "Tim" OVER like WHERE properties(edge).likeness > 8.0 YIELD dst(edge)` is shown in the following picture. ![AST](https://docs-cdn.nebula-graph.com.cn/docs-2.0/1.introduction/2.nebula-graph-architecture/parser-ast-tree.png) @@ -38,7 +38,7 @@ Validator performs a series of validations on the AST. It mainly works on these Validator will verify whether the cited variable exists or not, or whether the cited property is variable or not. - For composite statements, like `$var = GO FROM "Tim" OVER like YIELD like._dst AS ID; GO FROM $var.ID OVER serve YIELD serve._dst`, Validator verifies first to see if `var` is defined, and then to check if the `ID` property is attached to the `var` variable. + For composite statements, like `$var = GO FROM "Tim" OVER like YIELD dst(edge) AS ID; GO FROM $var.ID OVER serve YIELD dst(edge)`, Validator verifies first to see if `var` is defined, and then to check if the `ID` property is attached to the `var` variable. - Validating type inference @@ -50,13 +50,13 @@ Validator performs a series of validations on the AST. It mainly works on these Validator needs to verify all the Schema that involves `*` when verifying the clause if there is a `*` in the statement. - Take a statement like `GO FROM "Tim" OVER * YIELD like._dst, like.likeness, serve._dst` as an example. When verifying the `OVER` clause, Validator needs to verify all the edge types. If the edge type includes `like` and `serve`, the statement would be `GO FROM "Tim" OVER like,serve YIELD like._dst, like.likeness, serve._dst`. + Take a statement like `GO FROM "Tim" OVER * YIELD dst(edge), properties(edge).likeness, dst(edge)` as an example. When verifying the `OVER` clause, Validator needs to verify all the edge types. If the edge type includes `like` and `serve`, the statement would be `GO FROM "Tim" OVER like,serve YIELD dst(edge), properties(edge).likeness, dst(edge)`. - Validating input and output Validator will check the consistency of the clauses before and after the `|`. - In the statement `GO FROM "Tim" OVER like YIELD like._dst AS ID | GO FROM $-.ID OVER serve YIELD serve._dst`, Validator will verify whether `$-.ID` is defined in the clause before the `|`. + In the statement `GO FROM "Tim" OVER like YIELD dst(edge) AS ID | GO FROM $-.ID OVER serve YIELD dst(edge)`, Validator will verify whether `$-.ID` is defined in the clause before the `|`. When the validation succeeds, an execution plan will be generated. Its data structure will be stored in the `src/planner` directory. diff --git a/docs-2.0/14.client/4.nebula-java-client.md b/docs-2.0/14.client/4.nebula-java-client.md index a31987523ad..6c2e6b0673a 100644 --- a/docs-2.0/14.client/4.nebula-java-client.md +++ b/docs-2.0/14.client/4.nebula-java-client.md @@ -101,7 +101,7 @@ try { ResultSet resp = session.execute(insertEdges); // query - String query = "GO FROM \"Bob\" OVER like " + "YIELD $$.person.name, $$.person.age, like.likeness"; + String query = "GO FROM \"Bob\" OVER like " + "YIELD properties($$).name, properties($$).age, properties(edge).likeness"; ResultSet resp = session.execute(query); printResult(resp); }finally { 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 8f6a7d30227..127ba504a05 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 @@ -324,14 +324,15 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * Filter the players that the player with VID `player100` follows whose age is equal to or greater than 35. Rename the corresponding columns in the results with `Teammate` and `Age`. ```ngql - nebula> GO FROM "player100" OVER follow WHERE $$.player.age >= 35 \ - YIELD $$.player.name AS Teammate, $$.player.age AS Age; - +---------------+-----+ - | Teammate | Age | - +---------------+-----+ - | "Tony Parker" | 36 | - +---------------+-----+ - Got 1 rows (time spent 8206/9335 us) + nebula> GO FROM "player100" OVER follow WHERE properties($$).age >= 35 \ + YIELD properties($$).name AS Teammate, properties($$).age AS Age; + +-----------------+-----+ + | Teammate | Age | + +-----------------+-----+ + | "Tony Parker" | 36 | + +-----------------+-----+ + | "Manu Ginobili" | 41 | + +-----------------+-----+ ``` |Clause/Sign|Description| @@ -345,15 +346,18 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * With a pipe: ```ngql - nebula> GO FROM "player100" OVER follow YIELD follow._dst AS id | \ - GO FROM $-.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; - +-----------+---------------+ - | Team | Player | - +-----------+---------------+ - | "Nuggets" | "Tony Parker" | - +-----------+---------------+ - Got 1 rows (time spent 5055/8203 us) + nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ + GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; + +-----------+-----------------+ + | Team | Player | + +-----------+-----------------+ + | "Spurs" | "Tony Parker" | + +-----------+-----------------+ + | "Hornets" | "Tony Parker" | + +-----------+-----------------+ + | "Spurs" | "Manu Ginobili" | + +-----------+-----------------+ ``` |Clause/Sign|Description| @@ -369,15 +373,18 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi Once a composite statement is submitted to the server as a whole, the life cycle of the temporary variables in the statement ends. ```ngql - nebula> $var = GO FROM "player100" OVER follow YIELD follow._dst AS id; \ - GO FROM $var.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; - +---------+-------------+ - | Team | Player | - +---------+-------------+ - | Nuggets | Tony Parker | - +---------+-------------+ - Got 1 rows (time spent 3103/3711 us) + nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ + GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; + +-----------+-----------------+ + | Team | Player | + +-----------+-----------------+ + | "Spurs" | "Tony Parker" | + +-----------+-----------------+ + | "Hornets" | "Tony Parker" | + +-----------+-----------------+ + | "Spurs" | "Manu Ginobili" | + +-----------+-----------------+ ``` ### Example of `FETCH` statement @@ -391,7 +398,6 @@ nebula> FETCH PROP ON player "player100"; +----------------------------------------------------+ | ("player100" :player{age: 42, name: "Tim Duncan"}) | +----------------------------------------------------+ -Got 1 rows (time spent 2006/2406 us) ``` !!! Note 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 3f87dcf5f04..28217d2fc4e 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 @@ -153,8 +153,8 @@ Feature: Comparison of where clause When profiling query: """ GO FROM "player100" OVER follow - WHERE follow.degree IN [v IN [95,99] WHERE v > 0] - YIELD follow._dst, follow.degree + WHERE properties(edge).degree IN [v IN [95,99] WHERE v > 0] + YIELD dst(edge), properties(edge).degree """ Then the result should be, in any order: | follow._dst | follow.degree | @@ -163,7 +163,7 @@ Feature: Comparison of where clause And the execution plan should be: | id | name | dependencies | operator info | | 0 | Project | 1 | | - | 1 | GetNeighbors | 2 | {"filter": "(follow.degree IN [v IN [95,99] WHERE (v>0)])"} | + | 1 | GetNeighbors | 2 | {"filter": "(properties(edge).degree IN [v IN [95,99] WHERE (v>0)])"} | | 2 | Start | | | ``` diff --git a/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md b/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md index f9ab9fed1e0..889f0c4cefd 100644 --- a/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md +++ b/docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md @@ -13,7 +13,7 @@ nGQL does not have strict formatting requirements, but creating nGQL statements Not recommended: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id; + GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id; ``` Recommended: @@ -21,7 +21,7 @@ nGQL does not have strict formatting requirements, but creating nGQL statements ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD follow._dst AS id; + YIELD src(edge) AS id; ``` 2. Start a new line to write different statements in a composite statement. @@ -29,8 +29,8 @@ nGQL does not have strict formatting requirements, but creating nGQL statements Not recommended: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id | GO FROM $-.id \ - OVER serve WHERE $^.player.age > 20 YIELD $^.player.name AS FriendOf, $$.team.name AS Team; + 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; ``` Recommended: @@ -38,10 +38,10 @@ nGQL does not have strict formatting requirements, but creating nGQL statements ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD follow._dst AS id | \ + YIELD src(edge) AS id | \ GO FROM $-.id OVER serve \ - WHERE $^.player.age > 20 \ - YIELD $^.player.name AS FriendOf, $$.team.name AS Team; + WHERE properties($^).age > 20 \ + YIELD properties($^).name AS FriendOf, properties($$).name AS Team; ``` 3. If the clause exceeds 80 characters, start a new line at the appropriate place. @@ -218,10 +218,10 @@ The strings should be surrounded by double quotes. ```ngql GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id; | \ + YIELD dst(edge) AS id; | \ GO FROM $-.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` Supported: @@ -229,10 +229,10 @@ The strings should be surrounded by double quotes. ```ngql GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id | \ + YIELD dst(edge) AS id | \ GO FROM $-.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` 3. In a composite statement that contains user-defined variables, use an English semicolon to end the statements that define the variables. If you do not follow the rules to add a semicolon or use a pipe to end the composite statement, the execution will fail. diff --git a/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md b/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md index 32c95ba8003..6b7ff3b3626 100644 --- a/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md +++ b/docs-2.0/3.ngql-guide/12.vertex-statements/4.delete-vertex.md @@ -27,7 +27,7 @@ nebula> DELETE VERTEX "team1"; This query shows that you can use `DELETE VERTEX` together with pipe to delete vertices. ```ngql -nebula> GO FROM "player100" OVER serve WHERE serve.start_year == "2021" YIELD serve._dst AS id | DELETE VERTEX $-.id; +nebula> GO FROM "player100" OVER serve WHERE properties(edge).start_year == "2021" YIELD dst(edge) AS id | DELETE VERTEX $-.id; ``` ## Delete the process and the related edges diff --git a/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md index 053050759a3..6a681d62256 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/2.update-edge.md @@ -31,7 +31,7 @@ The following example checks the properties of the edge with the GO statement. ```ngql nebula> GO FROM "player100" \ OVER serve \ - YIELD serve.start_year, serve.end_year; + YIELD properties(edge).start_year, properties(edge).end_year; +------------------+----------------+ | serve.start_year | serve.end_year | +------------------+----------------+ diff --git a/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md index 07966f5d598..3373baeaa92 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/4.delete-edge.md @@ -24,7 +24,7 @@ The following example shows that you can use `DELETE EDGE` together with pipe op ```ngql nebula> GO FROM "player100" OVER follow \ - WHERE follow._dst == "team204" \ - YIELD follow._src AS src, follow._dst AS dst, follow._rank AS rank \ + WHERE dst(edge) == "team204" \ + YIELD src(edge) AS src, dst(edge) AS dst, rank(edge) AS rank \ | DELETE EDGE follow $-.src->$-.dst @ $-.rank; ``` diff --git a/docs-2.0/3.ngql-guide/3.data-types/6.list.md b/docs-2.0/3.ngql-guide/3.data-types/6.list.md index 750c826c95e..8018a3939fa 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/6.list.md +++ b/docs-2.0/3.ngql-guide/3.data-types/6.list.md @@ -180,8 +180,8 @@ nebula> RETURN size([1,2,3]); +---------------+ # The following query calculates the elements in the list [92,90] and runs a conditional judgment in a where clause. -nebula> GO FROM "player100" OVER follow WHERE follow.degree NOT IN [x IN [92, 90] | x + $$.player.age] \ - YIELD follow._dst AS id, follow.degree AS degree; +nebula> GO FROM "player100" OVER follow WHERE properties(edge).degree NOT IN [x IN [92, 90] | x + $$.player.age] \ + YIELD dst(edge) AS id, properties(edge).degree AS degree; +-------------+--------+ | id | degree | +-------------+--------+ diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md index b72b3bb6dee..8ed7ef39b82 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/1.composite-queries.md @@ -58,12 +58,16 @@ For example, a query is composed of three sub-queries: `A B C`, `A | B | C` or ` ```ngql # Connect multiple queries with pipes. - nebula> GO FROM "player100" OVER follow YIELD follow._dst AS id | \ - GO FROM $-.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; - +---------+-------------+ - | Team | Player | - +---------+-------------+ - | Nuggets | Tony Parker | - +---------+-------------+ + nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ + GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; + +-----------+-----------------+ + | Team | Player | + +-----------+-----------------+ + | "Spurs" | "Tony Parker" | + +-----------+-----------------+ + | "Hornets" | "Tony Parker" | + +-----------+-----------------+ + | "Spurs" | "Manu Ginobili" | + +-----------+-----------------+ ``` diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md index f9c0ec5dce8..7e4cd05c410 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/2.user-defined-variables.md @@ -32,12 +32,16 @@ You can use user-defined variables in composite queries. Details about composite ## Example ```ngql -nebula> $var = GO FROM "player100" OVER follow YIELD follow._dst AS id; \ - GO FROM $var.id OVER serve YIELD $$.team.name AS Team, \ - $^.player.name AS Player; -+---------+-------------+ -| Team | Player | -+---------+-------------+ -| Nuggets | Tony Parker | -+---------+-------------+ +nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ + GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ + properties($^).name AS Player; ++-----------+-----------------+ +| Team | Player | ++-----------+-----------------+ +| "Spurs" | "Tony Parker" | ++-----------+-----------------+ +| "Hornets" | "Tony Parker" | ++-----------+-----------------+ +| "Spurs" | "Manu Ginobili" | ++-----------+-----------------+ ``` diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md index bf329c5124e..e877cbc658b 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md @@ -61,7 +61,7 @@ Apart from the user-defined edge property, there are four built-in properties in The following query returns the `name` property of the `player` tag on the source vertex and the `age` property of the `player` tag on the destination vertex. ```ngql -nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.player.age AS endAge; +nebula> GO FROM "player100" OVER follow YIELD properties($^).name AS startName, properties($$).age AS endAge; +--------------+--------+ | startName | endAge | +--------------+--------+ @@ -74,7 +74,7 @@ nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.pl The following query returns the `degree` property of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD follow.degree; +nebula> GO FROM "player100" OVER follow YIELD properties(edge).degree; +---------------+ | follow.degree | +---------------+ @@ -87,12 +87,12 @@ nebula> GO FROM "player100" OVER follow YIELD follow.degree; The following query returns the source vertex, the destination vertex, the edge type, and the edge rank value of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD follow._src, follow._dst, follow._type, follow._rank; -+-------------+-------------+--------------+--------------+ -| follow._src | follow._dst | follow._type | follow._rank | -+-------------+-------------+--------------+--------------+ -| "player100" | "player101" | 136 | 0 | -+-------------+-------------+--------------+--------------+ -| "player100" | "player102" | 136 | 0 | -+-------------+-------------+--------------+--------------+ +nebula> GO FROM "player100" OVER follow YIELD src(edge), dst(edge), type(edge), rank(edge); ++-------------+-------------+------------+------------+ +| src(EDGE) | dst(EDGE) | type(EDGE) | rank(EDGE) | ++-------------+-------------+------------+------------+ +| "player100" | "player101" | "follow" | 0 | ++-------------+-------------+------------+------------+ +| "player100" | "player125" | "follow" | 0 | ++-------------+-------------+------------+------------+ ``` diff --git a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md index aabee9ac329..9b634f51a21 100644 --- a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md +++ b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md @@ -190,13 +190,15 @@ nebula> RETURN "a" IS NOT EMPTY; | true | +------------------+ -nebula> GO FROM "player100" OVER * WHERE $$.player.name IS NOT EMPTY YIELD follow._dst; +nebula> GO FROM "player100" OVER * WHERE properties($$).name IS NOT EMPTY YIELD dst(edge); +-------------+ -| follow._dst | +| dst(EDGE) | +-------------+ -| "player125" | +| "team204" | +-------------+ | "player101" | +-------------+ +| "player125" | ++-------------+ ``` diff --git a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md index 686afe14187..99df7df1ed0 100644 --- a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md +++ b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md @@ -18,7 +18,7 @@ One major difference between nGQL and SQL is how sub-queries are composed. ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD follow._dst AS dstid, $$.player.name AS Name | \ + YIELD dst(edge) AS dstid, properties($$).name AS Name | \ GO FROM $-.dstid OVER follow; +-------------+ @@ -26,6 +26,7 @@ nebula> GO FROM "player100" OVER follow \ +-------------+ | "player101" | +-------------+ +|... | ``` If there is no `YIELD` clause to define the output, the destination vertex ID is returned by default. If a YIELD clause is applied, the output is defined by the YIELD clause. diff --git a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md index 7636c079fe8..ee25735a540 100644 --- a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md +++ b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md @@ -18,7 +18,7 @@ Reference operators apply to native nGQL only. ```ngql # The following example returns the age of the source vertex and the destination vertex. -nebula> GO FROM "player100" OVER follow YIELD $^.player.age AS SrcAge, $$.player.age AS DestAge; +nebula> GO FROM "player100" OVER follow YIELD properties($^).age AS SrcAge, properties($$).age AS DestAge; +--------+---------+ | SrcAge | DestAge | +--------+---------+ @@ -29,9 +29,9 @@ nebula> GO FROM "player100" OVER follow YIELD $^.player.age AS SrcAge, $$.player # The following example returns the name and team of the players that player100 follows. nebula> GO FROM "player100" OVER follow \ - YIELD follow._dst AS id | \ + YIELD dst(edge) AS id | \ GO FROM $-.id OVER serve \ - YIELD $^.player.name AS Player, $$.team.name AS Team; + YIELD $^.player.name AS Player, properties($$).name AS Team; +-----------------+-----------+ | Player | Team | +-----------------+-----------+ diff --git a/docs-2.0/3.ngql-guide/5.operators/6.set.md b/docs-2.0/3.ngql-guide/5.operators/6.set.md index 8f733911ad5..7c863446ee6 100644 --- a/docs-2.0/3.ngql-guide/5.operators/6.set.md +++ b/docs-2.0/3.ngql-guide/5.operators/6.set.md @@ -28,7 +28,7 @@ nebula> GO FROM "player102" OVER follow \ UNION \ GO FROM "player100" OVER follow; +-------------+ -| follow._dst | +| dst(edge) | +-------------+ | "player101" | +-------------+ @@ -40,7 +40,7 @@ nebula> GO FROM "player102" OVER follow \ UNION ALL \ GO FROM "player100" OVER follow; +-------------+ -| follow._dst | +| dst(edge) | +-------------+ | "player101" | +-------------+ @@ -51,18 +51,20 @@ nebula> GO FROM "player102" OVER follow \ # UNION can also work with the YIELD statement. The DISTINCT keyword will check duplication by all the columns for every line, and remove duplicated lines if every column is the same. nebula> GO FROM "player102" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age \ + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age \ UNION /* DISTINCT */ \ GO FROM "player100" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age; + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; +-------------+--------+-----+ | id | Degree | Age | +-------------+--------+-----+ -| "player101" | 75 | 36 | +| "player100" | 75 | 42 | +-------------+--------+-----+ -| "player101" | 96 | 36 | +| "player101" | 75 | 36 | +-------------+--------+-----+ -| "player102" | 90 | 33 | +| "player101" | 95 | 36 | ++-------------+--------+-----+ +| "player125" | 95 | 41 | +-------------+--------+-----+ ``` @@ -80,10 +82,10 @@ nebula> GO FROM "player102" OVER follow \ ```ngql nebula> GO FROM "player102" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age \ + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age \ INTERSECT \ GO FROM "player100" OVER follow \ - YIELD follow._dst AS id, follow.degree AS Degree, $$.player.age AS Age; + YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; Empty set (time spent 2990/3511 us) ``` @@ -102,7 +104,7 @@ nebula> GO FROM "player100" OVER follow \ MINUS \ GO FROM "player102" OVER follow; +-------------+ -| follow._dst | +| dst(edge) | +-------------+ | "player102" | +-------------+ @@ -121,18 +123,22 @@ Please note that when a query contains a pipe `|` and a set operator, the pipe t ```ngql nebula> GO FROM "player102" OVER follow \ - YIELD follow._dst AS play_dst \ + YIELD dst(edge) AS play_dst \ UNION \ GO FROM "team200" OVER serve REVERSELY \ - YIELD serve._dst AS play_dst \ - | GO FROM $-.play_dst OVER follow YIELD follow._dst AS play_dst; + YIELD src(edge) AS play_src \ + | GO FROM $-.play_src OVER follow YIELD dst(edge) AS play_dst; +-------------+ | play_dst | +-------------+ +| "player100" | ++-------------+ | "player101" | +-------------+ -| "player102" | +| "player117" | ++-------------+ +| "player105" | +-------------+ ``` @@ -144,11 +150,11 @@ The parentheses can change the execution priority. For example: ```ngql nebula> (GO FROM "player102" OVER follow \ - YIELD follow._dst AS play_dst \ + YIELD dst(edge) AS play_dst \ UNION \ GO FROM "team200" OVER serve REVERSELY \ - YIELD serve._dst AS play_dst) \ - | GO FROM $-.play_dst OVER follow YIELD follow._dst AS play_dst; + YIELD src(edge) AS play_dst) \ + | GO FROM $-.play_dst OVER follow YIELD dst(edge) AS play_dst; ``` In the above query, the statements within the parentheses take precedence. That is, the `UNION` operation will be executed first, and its output will be executed as the input of the next operation with pipes. diff --git a/docs-2.0/3.ngql-guide/5.operators/7.string.md b/docs-2.0/3.ngql-guide/5.operators/7.string.md index 563b8fa26f1..a7be0a24c7d 100644 --- a/docs-2.0/3.ngql-guide/5.operators/7.string.md +++ b/docs-2.0/3.ngql-guide/5.operators/7.string.md @@ -47,19 +47,19 @@ nebula> MATCH (s:player)-[e:serve]->(t:team) WHERE id(s) == "player101" \ | "Tony Parker" | 2018 | 2019 | "Hornets" | +---------------+--------------+------------+-----------+ -nebula> GO FROM "player101" OVER serve WHERE (STRING)serve.start_year CONTAINS "19" AND \ - $^.player.name CONTAINS "ny" \ - YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name; +nebula> GO FROM "player101" OVER serve WHERE (STRING)properties(edge).start_year CONTAINS "19" AND \ + properties($^).name CONTAINS "ny" \ + YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name; +----------------+------------------+----------------+--------------+ -| $^.player.name | serve.start_year | serve.end_year | $$.team.name | +| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | +----------------+------------------+----------------+--------------+ | "Tony Parker" | 1999 | 2018 | "Spurs" | +----------------+------------------+----------------+--------------+ -nebula> GO FROM "player101" OVER serve WHERE !($$.team.name CONTAINS "ets") \ - YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name; +nebula> GO FROM "player101" OVER serve WHERE !(properties($$).name CONTAINS "ets") \ + YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, $$.team.name; +----------------+------------------+----------------+--------------+ -| $^.player.name | serve.start_year | serve.end_year | $$.team.name | +| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | +----------------+------------------+----------------+--------------+ | "Tony Parker" | 1999 | 2018 | "Spurs" | +----------------+------------------+----------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md index a033a07037d..c3de8c36958 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md @@ -53,18 +53,18 @@ double radians() | Converts degrees to radians. `radians(180)` returns `3.141592 ```ngql # The following statement supports aggregate functions. -nebula> GO FROM "Tim Duncan" OVER like YIELD like._dst AS dst, $$.player.age AS age \ +nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS dst, properties($$).age AS age \ | GROUP BY $-.dst \ YIELD \ $-.dst AS dst, \ toInteger((sum($-.age)/count($-.age)))+avg(distinct $-.age+1)+1 AS statistics; -+-----------------+------------+ -| dst | statistics | -+-----------------+------------+ -| "Tony Parker" | 74.0 | -+-----------------+------------+ -| "Manu Ginobili" | 84.0 | -+-----------------+------------+ ++-------------+------------+ +| dst | statistics | ++-------------+------------+ +| "player125" | 84.0 | ++-------------+------------+ +| "player101" | 74.0 | ++-------------+------------+ Got 2 rows (time spent 4739/5064 us) ``` diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md index 52f82fb4be8..194ff32817d 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/11.reduce.md @@ -64,8 +64,8 @@ nebula> MATCH p = (n:player{name:"LeBron James"})<-[:follow]-(m) \ nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ | GO FROM $-.VertexID over follow \ - WHERE follow.degree != reduce(totalNum = 5, n IN range(1, 3) | $$.player.age + totalNum + n) \ - YIELD $$.player.name AS id, $$.player.age AS age, follow.degree AS degree; + WHERE properties(edge).degree != reduce(totalNum = 5, n IN range(1, 3) | properties($$).age + totalNum + n) \ + YIELD properties($$).name AS id, properties($$).age AS age, properties(edge).degree AS degree; +---------------------+-----+--------+ | id | age | degree | +---------------------+-----+--------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md index 7be8e392f96..e7d285feed4 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md @@ -36,7 +36,7 @@ nebula> RETURN concat("1","2",NULL) AS r; +----------+ nebula> GO FROM "player100" over follow \ - YIELD concat(follow._src, $^.player.age, $$.player.name, follow.degree) AS A; + YIELD concat(src(edge), properties($^).age, properties($$).name, properties(edge).degree) AS A; +------------------------------+ | A | +------------------------------+ @@ -98,7 +98,7 @@ nebula> RETURN concat_ws("+","a") AS r; +-----+ nebula> GO FROM "player100" over follow \ - YIELD concat_ws(" ",follow._src, $^.player.age, $$.player.name, follow.degree) AS A; + YIELD concat_ws(" ",src(edge), properties($^).age, properties($$).name, properties(edge).degree) AS A; +---------------------------------+ | A | +---------------------------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md index 1cb222df372..2dc2ac22d5b 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md @@ -46,20 +46,20 @@ nebula> RETURN \ ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD $$.player.name AS Name, \ - CASE $$.player.age > 35 \ + YIELD properties($$).name AS Name, \ + CASE properties($$).age > 35 \ WHEN true THEN "Yes" \ WHEN false THEN "No" \ ELSE "Nah" \ END \ AS Age_above_35; -+---------------------+--------------+ -| Name | Age_above_35 | -+---------------------+--------------+ -| "Tony Parker" | "Yes" | -+---------------------+--------------+ -| "LaMarcus Aldridge" | "No" | -+---------------------+--------------+ ++-----------------+--------------+ +| Name | Age_above_35 | ++-----------------+--------------+ +| "Tony Parker" | "Yes" | ++-----------------+--------------+ +| "Manu Ginobili" | "Yes" | ++-----------------+--------------+ ``` ## The generic form of CASE expressions @@ -121,9 +121,9 @@ To avoid the misuse of the simple form and the generic form, it is important to ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD $$.player.name AS Name, $$.player.age AS Age, \ - CASE $$.player.age \ - WHEN $$.player.age > 35 THEN "Yes" \ + YIELD properties($$).name AS Name, properties($$).age AS Age, \ + CASE properties($$).age \ + WHEN properties($$).age > 35 THEN "Yes" \ ELSE "No" \ END \ AS Age_above_35; diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md index 663fd048ea7..7bafb8bd4b8 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md @@ -33,7 +33,7 @@ nebula> WITH [NULL, 1, 1, 2, 2] As a UNWIND a AS b \ ```ngql # The statement in the following example searches for the people whom `player101` follows and people who follow `player101`, i.e. a bidirectional query. nebula> GO FROM "player101" OVER follow BIDIRECT \ - YIELD $$.player.name AS Name \ + YIELD properties($$).name AS Name \ | GROUP BY $-.Name YIELD $-.Name, count(*); +---------------------+----------+ | $-.Name | count(*) | diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md index 5e56cac9f5d..5c5d858b996 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md @@ -156,12 +156,12 @@ Use a `YIELD` clause to fetch specific properties of an edge. ```ngql nebula> FETCH PROP ON serve "player100" -> "team204" \ - YIELD serve.start_year; -+-------------+------------+-------------+------------------+ -| serve._src | serve._dst | serve._rank | serve.start_year | -+-------------+------------+-------------+------------------+ -| "player100" | "team204" | 0 | 1997 | -+-------------+------------+-------------+------------------+ + YIELD properties(edge).start_year; ++-------------+------------+-------------+-----------------------------+ +| serve._src | serve._dst | serve._rank | properties(EDGE).start_year | ++-------------+------------+-------------+-----------------------------+ +| "player100" | "team204" | 0 | 1997 | ++-------------+------------+-------------+-----------------------------+ ``` ### Fetch properties of multiple edges @@ -216,36 +216,36 @@ The following statement returns the `degree` values of the `follow` edges that s ```ngql nebula> GO FROM "player101" OVER follow \ - YIELD follow._src AS s, follow._dst AS d |\ - FETCH PROP ON follow $-.s -> $-.d \ - YIELD follow.degree; -+-------------+-------------+--------------+---------------+ -| follow._src | follow._dst | follow._rank | follow.degree | -+-------------+-------------+--------------+---------------+ -| "player101" | "player100" | 0 | 95 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player125" | 0 | 95 | -+-------------+-------------+--------------+---------------+ + YIELD src(edge) AS s, dst(edge) AS d \ + | FETCH PROP ON follow $-.s -> $-.d \ + YIELD properties(edge).degree; ++-------------+-------------+--------------+-------------------------+ +| follow._src | follow._dst | follow._rank | properties(EDGE).degree | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ ``` Or you can use user-defined variables to construct similar queries. ```ngql nebula> $var = GO FROM "player101" OVER follow \ - YIELD follow._src AS s, follow._dst AS d; \ + YIELD src(edge) AS s, dst(edge) AS d; \ FETCH PROP ON follow $var.s -> $var.d \ - YIELD follow.degree; -+-------------+-------------+--------------+---------------+ -| follow._src | follow._dst | follow._rank | follow.degree | -+-------------+-------------+--------------+---------------+ -| "player101" | "player100" | 0 | 95 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+--------------+---------------+ -| "player101" | "player125" | 0 | 95 | -+-------------+-------------+--------------+---------------+ + YIELD properties(edge).degree; ++-------------+-------------+--------------+-------------------------+ +| follow._src | follow._dst | follow._rank | properties(EDGE).degree | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ ``` For more information about composite queries, see [Composite queries (clause structure)](../4.variable-and-composite-queries/1.composite-queries.md). diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md index 54700afbc1f..07259f017f1 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md @@ -86,7 +86,7 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name == "Tony Parker" \ - YIELD player.name AS name, player.age AS age; + YIELD properties(vertex).name AS name, properties(vertex).age AS age; +-------------+---------------+-----+ | VertexID | name | age | +-------------+---------------+-----+ @@ -106,20 +106,20 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name STARTS WITH "B" \ AND player.age IN [22,30] \ - YIELD player.name, player.age; -+-------------+-----------------+------------+ -| VertexID | player.name | player.age | -+-------------+-----------------+------------+ -| "player149" | "Ben Simmons" | 22 | -+-------------+-----------------+------------+ -| "player134" | "Blake Griffin" | 30 | -+-------------+-----------------+------------+ + YIELD properties(vertex).name, properties(vertex).age; ++-------------+-------------------------+------------------------+ +| VertexID | properties(VERTEX).name | properties(VERTEX).age | ++-------------+-------------------------+------------------------+ +| "player149" | "Ben Simmons" | 22 | ++-------------+-------------------------+------------------------+ +| "player134" | "Blake Griffin" | 30 | ++-------------+-------------------------+------------------------+ nebula> LOOKUP ON player \ WHERE player.name == "Kobe Bryant" \ - YIELD player.name AS name |\ + YIELD properties(vertex).name AS name |\ GO FROM $-.VertexID OVER serve \ - YIELD $-.name, serve.start_year, serve.end_year, $$.team.name; + YIELD $-.name, properties(edge).start_year, properties(edge).end_year, properties($$).name; +---------------+------------------+----------------+--------------+ | $-.name | serve.start_year | serve.end_year | $$.team.name | +---------------+------------------+----------------+--------------+ @@ -156,23 +156,23 @@ nebula> LOOKUP ON follow \ nebula> LOOKUP ON follow \ WHERE follow.degree == 90 \ - YIELD follow.degree; -+-------------+-------------+---------+---------------+ -| SrcVID | DstVID | Ranking | follow.degree | -+-------------+-------------+---------+---------------+ -| "player101" | "player102" | 0 | 90 | -+-------------+-------------+---------+---------------+ -| "player133" | "player114" | 0 | 90 | -+-------------+-------------+---------+---------------+ -| "player133" | "player144" | 0 | 90 | -+-------------+-------------+---------+---------------+ + YIELD properties(edge).degree; ++-------------+-------------+---------+-------------------------+ +| SrcVID | DstVID | Ranking | properties(EDGE).degree | ++-------------+-------------+---------+-------------------------+ +| "player121" | "player116" | 0 | 90 | ++-------------+-------------+---------+-------------------------+ +| "player121" | "player128" | 0 | 90 | ++-------------+-------------+---------+-------------------------+ +| "player121" | "player129" | 0 | 90 | ++-------------+-------------+---------+-------------------------+ ... nebula> LOOKUP ON follow \ WHERE follow.degree == 60 \ - YIELD follow.degree AS Degree |\ + YIELD properties(edge).degree AS Degree |\ GO FROM $-.DstVID OVER serve \ - YIELD $-.DstVID, serve.start_year, serve.end_year, $$.team.name; + YIELD $-.DstVID, properties(edge).start_year, properties(edge).end_year, properties($$).name; +-------------+------------------+----------------+--------------+ | $-.DstVID | serve.start_year | serve.end_year | $$.team.name | +-------------+------------------+----------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md index 7d2b2cafaab..4461785baa3 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md @@ -44,7 +44,7 @@ The following statement finds all the vertices connected directly to vertex `"pl ```ngql nebula> GO FROM "player100" OVER follow BIDIRECT \ - YIELD $$.player.name as Name \ + YIELD properties($$).name as Name \ | GROUP BY $-.Name \ YIELD $-.Name as Player, count(*) AS Name_Count; +---------------------+------------+ @@ -78,7 +78,7 @@ The following statement finds all the vertices connected directly to vertex `"pl ```ngql nebula> GO FROM "player100" OVER follow \ - YIELD follow._src AS player, follow.degree AS degree \ + YIELD src(edge) AS player, properties(edge).degree AS degree \ | GROUP BY $-.player \ YIELD sum($-.degree); +----------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md index e758cb399ae..a908352526c 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md @@ -30,7 +30,7 @@ YIELD ```ngql # The following example returns the 3 rows of data starting from the second row of the sorted output. nebula> GO FROM "player100" OVER follow REVERSELY \ - YIELD $$.player.name AS Friend, $$.player.age AS Age \ + YIELD properties($$).name AS Friend, properties($$).age AS Age \ | ORDER BY $-.Age, $-.Friend \ | LIMIT 1, 3; +-------------------+-----+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md index ba985a54ef5..b3802c973a8 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md @@ -41,7 +41,7 @@ nebula> FETCH PROP ON player "player100", "player101", "player102", "player103" +-------------+-----+---------------------+ nebula> $var = GO FROM "player100" OVER follow \ - YIELD follow._dst AS dst; \ + YIELD dst(edge) AS dst; \ ORDER BY $var.dst DESC; +-------------+ | dst | diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md index f32c521bfd1..0dcb4dcc9cc 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md @@ -48,16 +48,15 @@ nebula> MATCH (v:player) \ ```ngql nebula> GO FROM "player100" \ OVER follow \ - WHERE follow.degree > 90 \ - OR $$.player.age != 33 \ - AND $$.player.name != "Tony Parker"; -+-------------+ -| follow._dst | -+-------------+ -| "player101" | -+-------------+ -| "player125" | -+-------------+ + WHERE properties(edge).degree > 90 \ + OR properties($$).age != 33 \ + AND properties($$).name != "Tony Parker" \ + YIELD properties($$); ++----------------------------------+ +| properties($$) | ++----------------------------------+ +| {age: 41, name: "Manu Ginobili"} | ++----------------------------------+ ``` ### Filter on properties @@ -180,20 +179,20 @@ nebula> INSERT EDGE e1(p1) VALUES "1"->"2"@6:(16); # The following example use rank to filter edges and retrieves edges with a rank greater than 2. nebula> GO FROM "1" \ OVER e1 \ - WHERE e1._rank>2 \ - YIELD e1._src, e1._dst, e1._rank AS Rank, e1.p1 | \ + WHERE rank(edge) > 2 \ + YIELD src(edge), dst(edge), rank(edge) AS Rank, properties(edge).p1 | \ ORDER BY $-.Rank DESC; -==================================== -| e1._src | e1._dst | Rank | e1.p1 | -==================================== -| 1 | 2 | 6 | 16 | ------------------------------------- -| 1 | 2 | 5 | 15 | ------------------------------------- -| 1 | 2 | 4 | 14 | ------------------------------------- -| 1 | 2 | 3 | 13 | ------------------------------------- ++-----------+-----------+------+---------------------+ +| src(EDGE) | dst(EDGE) | Rank | properties(EDGE).p1 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 6 | 16 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 5 | 15 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 4 | 14 | ++-----------+-----------+------+---------------------+ +| "1" | "2" | 3 | 13 | ++-----------+-----------+------+---------------------+ ``` ## Filter on strings @@ -340,20 +339,20 @@ nebula> MATCH (v:player) \ | "Joel Embiid" | 25 | +-------------------------+-------+ -nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD player.name, player.age; -+-------------+------------------+------------+ -| VertexID | player.name | player.age | -+-------------+------------------+------------+ -| "player135" | "Damian Lillard" | 28 | -+-------------+------------------+------------+ -| "player131" | "Paul George" | 28 | -+-------------+------------------+------------+ -| "player130" | "Joel Embiid" | 25 | -+-------------+------------------+------------+ -| "player123" | "Ricky Rubio" | 28 | -+-------------+------------------+------------+ -| "player106" | "Kyle Anderson" | 25 | -+-------------+------------------+------------+ +nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD properties(vertex).name, properties(vertex).age; ++-------------+-------------------------+------------------------+ +| VertexID | properties(VERTEX).name | properties(VERTEX).age | ++-------------+-------------------------+------------------------+ +| "player106" | "Kyle Anderson" | 25 | ++-------------+-------------------------+------------------------+ +| "player135" | "Damian Lillard" | 28 | ++-------------+-------------------------+------------------------+ +| "player130" | "Joel Embiid" | 25 | ++-------------+-------------------------+------------------------+ +| "player131" | "Paul George" | 28 | ++-------------+-------------------------+------------------------+ +| "player123" | "Ricky Rubio" | 28 | ++-------------+-------------------------+------------------------+ ``` ### Match values not in a list diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md index 86ae171dc75..11fa3226d7f 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md @@ -71,7 +71,7 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...]; ```ngql nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ - YIELD player.name, player.age; + YIELD properties(vertex).name, properties(vertex).age; ======================================= | VertexID | player.name | player.age | ======================================= diff --git a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md index fb76c49a09d..a9500b8513d 100644 --- a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md +++ b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md @@ -31,7 +31,7 @@ To query edge data on the **Console** page and then view the result on the **Exp Here is an nGQL statement example. ```ngql - nebula> GO FROM "player102" OVER serve YIELD serve._src,serve._dst; + nebula> GO FROM "player102" OVER serve YIELD src(edge),dst(edge); ``` In the query result, you can see the start year and end year of the service team for the player whose playerId is `palyer102`. As shown below. From 74b5126d7aa8bcf76e18cb9ab2ade5364ad7890a Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Wed, 20 Oct 2021 11:57:08 +0800 Subject: [PATCH 4/7] Update 4.schema.md --- .../6.functions-and-expressions/4.schema.md | 60 +++++++++++++++---- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md index 893709ed93c..cb3d4c1cf8d 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md @@ -1,25 +1,61 @@ # Schema functions +Nebula Graph supports the following schema functions. + +## For nGQL statements + !!! note - The functions introduced in this topic applies to compatible statements in openCypher only. + - The following functions are available in both the WHERE and YIELD clauses in GO statements. + - The following functions are only available in the YIELD clauses in LOOKUP statements. + - The following functions are unavailable in FETCH statements. -Nebula Graph supports the following built-in schema functions: +|Function| Description | +|---- | ----| +|id(vertex) | Returns the id of a vertex. The data type of the result is the same as the vertex ID.| +|map properties(vertex) | Returns the properties of a vertex.| +|map properties(edge) | Returns the properties of an edge.| +|string type(edge) | Returns the edge type of an edge.| +|src(edge)|Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID.| +|dst(edge)|Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID.| +|int rank(edge) | Returns the rank value of an edge.| -Function| Description | ----- | ----| -id(vertex) | Returns the id of a vertex. The data type of the result is the same as the vertex ID. -list tags(vertex) | Returns the tags of a vertex and has the same function as labels(). -list labels(vertex) | Returns the tags of a vertex and has the same function as tags() to be compatible with the openCypher syntax. -map properties(vertex_or_edge) | Takes in a vertex or an edge and returns its properties. -string type(edge) | Returns the edge type of an edge. -vertex startNode(path) | Takes in an edge or a path and returns its source vertex ID. -string endNode(path) | Takes in an edge or a path and returns its destination vertex ID. -int rank(edge) | Returns the rank value of an edge. +## For statements compatible with openCypher +|Function| Description | +|:---- | :----| +| id(\) | Returns the ID of a vertex. The data type of the result is the same as the vertex ID.| +|list tags(\) | Returns the tag of a vertex, which serves the same purpose as labels().| +|list labels(\) | Returns the tag of a vertex, which serves the same purpose as tags(). This function is used for compatibility with openCypher syntax.| +|map properties(\) | Returns the properties of a vertex or an edge.| +|string type(\) | Returns the edge type of an edge.| +|src(\)|Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID.| +|dst(\)|Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID.| +|vertex startNode(\) | Visits an edge or a path and returns its source vertex ID.| +|string endNode(\) | Visits an edge or a path and returns its destination vertex ID.| +|int rank(\) | Returns the rank value of an edge.| ## Examples ```ngql + +nebula> GO FROM "player100" OVER follow REVERSELY \ + YIELD src(edge) AS destination; ++-------------+ +| destination | ++-------------+ +| "player101" | ++-------------+ +| "player102" | ++-------------+ +nebula> LOOKUP ON player where player.age > 45 yield id(vertex); ++-------------+-------------+ +| VertexID | id(VERTEX) | ++-------------+-------------+ +| "player144" | "player144" | ++-------------+-------------+ +| "player140" | "player140" | ++-------------+-------------+ + nebula> MATCH (a:player) WHERE id(a) == "player100" \ RETURN tags(a), labels(a), properties(a); +------------+------------+-------------------------------+ From 27951b41f58691944b72613745ade381109f2a40 Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Wed, 20 Oct 2021 16:22:31 +0800 Subject: [PATCH 5/7] Update 4.schema.md --- docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md index cb3d4c1cf8d..f1dbd117f2f 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md @@ -47,7 +47,7 @@ nebula> GO FROM "player100" OVER follow REVERSELY \ +-------------+ | "player102" | +-------------+ -nebula> LOOKUP ON player where player.age > 45 yield id(vertex); +nebula> LOOKUP ON player WHERE player.age > 45 YIELD id(vertex); +-------------+-------------+ | VertexID | id(VERTEX) | +-------------+-------------+ From 16364ac9bbfdf2f99b5bdff9449f8d24667fbfe0 Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Thu, 21 Oct 2021 10:47:25 +0800 Subject: [PATCH 6/7] updates --- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 25 +++++++++++-------- .../6.functions-and-expressions/4.schema.md | 3 +-- .../7.general-query-statements/2.match.md | 2 +- .../7.general-query-statements/3.go.md | 8 ++---- .../7.general-query-statements/4.fetch.md | 2 +- .../8.clauses-and-options/yield.md | 4 +-- .../use-console/st-ug-open-in-explore.md | 2 +- 7 files changed, 22 insertions(+), 24 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 127ba504a05..79261e493dd 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 @@ -269,9 +269,12 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi ```ngql GO [[ TO] STEPS ] FROM - OVER [REVERSELY] [BIDIRECT] - [WHERE [AND | OR expression ...])] - YIELD [DISTINCT] ; + OVER [{REVERSELY | BIDIRECT}] + [ WHERE  ] + [YIELD [DISTINCT] ] + [| GROUP BY {col_name | expr | position} YIELD ] + [| ORDER BY [{ASC | DESC}]] + [| LIMIT [,] ]; ``` * `FETCH` @@ -279,24 +282,24 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi * Fetch properties on tags: ```ngql - FETCH PROP ON { | | *} - [YIELD [DISTINCT] ]; + FETCH PROP ON {[, tag_name ...] | *} + [, vid ...] + [YIELD [AS ]]; ``` * Fetch properties on edges: ```ngql - FETCH PROP ON -> [@] - [, -> ...] - [YIELD [DISTINCT] ]; + FETCH PROP ON -> [@] [, -> ...] + [YIELD ]; ``` * `LOOKUP` ```ngql - LOOKUP ON { | } - WHERE [AND expression ...])] - [YIELD ]; + LOOKUP ON { | } + [WHERE [AND ...]] + [YIELD [AS ]]; ``` * `MATCH` diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md index f1dbd117f2f..b6c2e0e926c 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md @@ -7,8 +7,7 @@ Nebula Graph supports the following schema functions. !!! note - The following functions are available in both the WHERE and YIELD clauses in GO statements. - - The following functions are only available in the YIELD clauses in LOOKUP statements. - - The following functions are unavailable in FETCH statements. + - The following functions are only available in the YIELD clauses in LOOKUP and YIELD statements. |Function| Description | |---- | ----| diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md index 4e19064d9b9..d504bd5dc98 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md @@ -11,7 +11,7 @@ The examples in this topic use the [basketballplayer](../1.nGQL-overview/1.overv The syntax of `MATCH` is relatively more flexible compared with that of other query statements such as `GO` or `LOOKUP`. But generally, it can be summarized as follows. ```ngql -MATCH [] RETURN +MATCH [] RETURN ; ``` ## The workflow of MATCH diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md b/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md index 683cd82f406..a7fb63e6b77 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md @@ -13,13 +13,9 @@ GO [[ TO] STEPS ] FROM OVER [{REVERSELY | BIDIRECT}] [ WHERE  ] [YIELD [DISTINCT] ] -[| ORDER BY [{ASC | DESC}]] -[| LIMIT [,] ] - -GO [[ TO] STEPS ] FROM -OVER [{REVERSELY | BIDIRECT}] -[ WHERE  ] [| GROUP BY {col_name | expr | position} YIELD ] +[| ORDER BY [{ASC | DESC}]] +[| LIMIT [,] ]; ::= [, ...] diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md index 5c5d858b996..f24cc1500c7 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md @@ -45,7 +45,7 @@ Use a `YIELD` clause to specify the properties to be returned. ```ngql nebula> FETCH PROP ON player "player100" \ - YIELD player.name AS name; + YIELD properties(vertex).name AS name; +-------------+--------------+ | VertexID | name | +-------------+--------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md index 11fa3226d7f..51896ca0696 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/yield.md @@ -59,7 +59,7 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...]; ```ngql nebula> FETCH PROP ON player "player100" \ - YIELD player.name; + YIELD properties(vertex).name; +-------------+--------------+ | VertexID | player.name | +-------------+--------------+ @@ -105,7 +105,7 @@ The following query finds the players that "player100" follows and calculates th nebula> GO FROM "player100" OVER follow \ YIELD follow._dst AS ID \ | FETCH PROP ON player $-.ID \ - YIELD player.age AS Age \ + YIELD properties(vertex).age AS Age \ | YIELD AVG($-.Age) as Avg_age, count(*)as Num_friends; +---------+-------------+ | Avg_age | Num_friends | diff --git a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md index a9500b8513d..7ec3701d7de 100644 --- a/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md +++ b/docs-2.0/nebula-studio/use-console/st-ug-open-in-explore.md @@ -81,7 +81,7 @@ To query vertex data on the **Console** page and then view the result on the **E Here is an nGQL statement example. ```ngql - nebula> FETCH PROP ON player "player100" YIELD player.name; + nebula> FETCH PROP ON player "player100" YIELD properties(vertex).name; ``` The query result gives the information of the player whose `playerId` is `player100`, as shown in this figure. From 68c8a58283e641c835bea60e9a68e8992c68fc17 Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Thu, 21 Oct 2021 11:53:51 +0800 Subject: [PATCH 7/7] Update 4.schema.md --- .../3.ngql-guide/6.functions-and-expressions/4.schema.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md index b6c2e0e926c..26433120b29 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md @@ -11,7 +11,7 @@ Nebula Graph supports the following schema functions. |Function| Description | |---- | ----| -|id(vertex) | Returns the id of a vertex. The data type of the result is the same as the vertex ID.| +|id(vertex) | Returns the ID of a vertex. The data type of the result is the same as the vertex ID.| |map properties(vertex) | Returns the properties of a vertex.| |map properties(edge) | Returns the properties of an edge.| |string type(edge) | Returns the edge type of an edge.| @@ -24,8 +24,8 @@ Nebula Graph supports the following schema functions. |Function| Description | |:---- | :----| | id(\) | Returns the ID of a vertex. The data type of the result is the same as the vertex ID.| -|list tags(\) | Returns the tag of a vertex, which serves the same purpose as labels().| -|list labels(\) | Returns the tag of a vertex, which serves the same purpose as tags(). This function is used for compatibility with openCypher syntax.| +|list tags(\) | Returns the Tag of a vertex, which serves the same purpose as labels().| +|list labels(\) | Returns the Tag of a vertex, which serves the same purpose as tags(). This function is used for compatibility with openCypher syntax.| |map properties(\) | Returns the properties of a vertex or an edge.| |string type(\) | Returns the edge type of an edge.| |src(\)|Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID.|