From a6701aadd34034f31b64de105d41f398834d3a20 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Mon, 18 Oct 2021 16:46:33 +0800 Subject: [PATCH 01/10] yield for full doc --- .../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 | 12 +-- .../1.nGQL-overview/ngql-style-guide.md | 34 ++++----- .../12.vertex-statements/4.delete-vertex.md | 2 +- .../13.edge-statements/2.update-edge.md | 2 +- .../13.edge-statements/3.upsert-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 | 9 ++- 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 | 34 +++++---- docs-2.0/3.ngql-guide/5.operators/7.string.md | 32 ++++---- .../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 | 56 +++++++------- .../7.general-query-statements/5.lookup.md | 48 ++++++------ .../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 +- 31 files changed, 267 insertions(+), 246 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 eeb4187915..fc901892b1 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 @@ Graph 服务主要负责处理查询请求,包括解析查询语句、校验 Parser 模块收到请求后,通过 Flex(词法分析工具)和 Bison(语法分析工具)生成的词法语法解析器,将语句转换为抽象语法树(AST),在语法解析阶段会拦截不符合语法规则的语句。 -例如`GO FROM "Tim" OVER like WHERE like.likeness > 8.0 YIELD like._dst`语句转换的 AST 如下。 +例如`GO FROM "Tim" OVER like WHERE properties(edge).likeness > 8.0 YIELD dst(edge)`语句转换的 AST 如下。 ![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 模块对生成的 AST 进行语义校验,主要包括: 校验引用的变量是否存在或者引用的属性是否属于变量。 - 例如语句`$var = GO FROM "Tim" OVER like YIELD like._dst AS ID; GO FROM $var.ID OVER serve YIELD serve._dst`,Validator 模块首先会检查变量 `var` 是否定义,其次再检查属性 `ID` 是否属于变量 `var`。 + 例如语句`$var = GO FROM "Tim" OVER like YIELD dst(edge) AS ID; GO FROM $var.ID OVER serve YIELD dst(edge)`,Validator 模块首先会检查变量 `var` 是否定义,其次再检查属性 `ID` 是否属于变量 `var`。 - 校验类型推断 @@ -50,13 +50,13 @@ Validator 模块对生成的 AST 进行语义校验,主要包括: 查询语句中包含 `*` 时,校验子句时需要将 `*` 涉及的Schema都进行校验。 - 例如语句`GO FROM "Tim" OVER * YIELD like._dst, like.likeness, serve._dst`,校验`OVER`子句时需要校验所有的 Edge type,如果 Edge type 包含 `like`和`serve`,该语句会展开为`GO FROM "Tim" OVER like,serve YIELD like._dst, like.likeness, serve._dst`。 + 例如语句`GO FROM "Tim" OVER * YIELD dst(edge), properties(edge).likeness, dst(edge)`,校验`OVER`子句时需要校验所有的 Edge type,如果 Edge type 包含 `like`和`serve`,该语句会展开为`GO FROM "Tim" OVER like,serve YIELD dst(edge), properties(edge).likeness, dst(edge)`。 - 校验输入输出 校验管道符(|)前后的一致性。 - 例如语句`GO FROM "Tim" OVER like YIELD like._dst AS ID | GO FROM $-.ID OVER serve YIELD serve._dst`,Validator 模块会校验 `$-.ID` 在管道符左侧是否已经定义。 + 例如语句`GO FROM "Tim" OVER like YIELD dst(edge) AS ID | GO FROM $-.ID OVER serve YIELD dst(edge)`,Validator 模块会校验 `$-.ID` 在管道符左侧是否已经定义。 校验完成后,Validator 模块还会生成一个默认可执行,但是未进行优化的执行计划,存储在目录 `src/planner` 内。 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 7ae1dcc909..a68f665e8e 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 2ad1e4485f..8b1343a3dd 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 @@ Execution succeeded (time spent 5858/6870 us) - 从VID为`player100`的球员开始,沿着边`follow`查找年龄大于或等于35岁的球员,并返回他们的姓名和年龄,同时重命名对应的列。 ```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 | + +-----------------+-----+ ``` |子句/符号|说明| @@ -345,15 +346,18 @@ Execution succeeded (time spent 5858/6870 us) - 使用管道符 ```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" | + +-----------+-----------------+ ``` |子句/符号|说明| @@ -369,15 +373,18 @@ Execution succeeded (time spent 5858/6870 us) 当复合语句作为一个整体提交给服务器时,其中的临时变量会在语句结束时被释放。 ```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" | + +-----------+-----------------+ ``` ### `FETCH`语句示例 @@ -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 8d612f0ac2..5316a4604a 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 @@ -156,18 +156,18 @@ 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 | | "player101" | 95 | | "player125" | 95 | 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)])"} | - | 2 | Start | | | + | id | name | dependencies | operator info | + | 0 | Project | 1 | | + | 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 5e87ce633d..7000c5a98f 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没有严格的构建格式要求,但根据恰当而统一的风格创建n 不推荐: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD follow._dst AS id; + GO FROM "player100" OVER follow REVERSELY YIELD dst(edge) AS id; ``` 推荐: @@ -21,7 +21,7 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```ngql GO FROM "player100" \ OVER follow REVERSELY \ - YIELD follow._dst AS id; + YIELD src(edge) AS id; ``` 2. 换行写复合语句中的不同语句。 @@ -29,8 +29,8 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n 不推荐: ```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; ``` 推荐: @@ -38,10 +38,10 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```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. 子句长度超过80个字符时,在合适的位置换行。 @@ -218,10 +218,10 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```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; ``` 支持: @@ -229,10 +229,10 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```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. 在包含自定义变量的复合语句中,用英文分号结束定义变量的语句。不按规则加分号或使用管道符结束该语句会导致执行失败。 @@ -242,10 +242,10 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```ngql $var = GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id \ + YIELD dst(edge) AS id \ GO FROM $var.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` 也不支持: @@ -253,10 +253,10 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```ngql $var = GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id | \ + YIELD dst(edge) AS id | \ GO FROM $var.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` 支持: @@ -264,8 +264,8 @@ nGQL没有严格的构建格式要求,但根据恰当而统一的风格创建n ```ngql $var = GO FROM "player100" \ OVER follow \ - YIELD follow._dst AS id; \ + YIELD dst(edge) AS id; \ GO FROM $var.id \ OVER serve \ - YIELD $$.team.name AS Team, $^.player.name AS Player; + YIELD properties($$).name AS Team, properties($^).name AS Player; ``` 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 c96df6bb25..647b0e53f6 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 @@ -24,7 +24,7 @@ nebula> DELETE VERTEX "team1"; ```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; ``` ## 删除过程与删除邻边 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 93e161db07..b874ae830d 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 @@ -30,7 +30,7 @@ SET // 用GO语句查看边的属性值。 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/3.upsert-edge.md b/docs-2.0/3.ngql-guide/13.edge-statements/3.upsert-edge.md index 78fd063e82..3d6ca6e742 100644 --- a/docs-2.0/3.ngql-guide/13.edge-statements/3.upsert-edge.md +++ b/docs-2.0/3.ngql-guide/13.edge-statements/3.upsert-edge.md @@ -57,7 +57,7 @@ SET // 查看如下三个点是否有serve类型的出边,结果“Empty set”表示没有serve类型的出边。 nebula> GO FROM "player666", "player667", "player668" \ OVER serve \ - YIELD serve.start_year, serve.end_year; + YIELD properties(edge).start_year, properties(edge).end_year; Empty set nebula> UPSERT EDGE on serve \ 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 fcab621202..15106d6150 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 @@ -22,7 +22,7 @@ nebula> DELETE EDGE serve "player100" -> "team204"@0; ```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 489bf92ba5..3d72c35c7b 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]); +---------------+ # 将列表[92,90]中的元素做运算,然后在where子句中进行条件判断。 -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 eefeadaa19..6ad092db24 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 @@ -59,12 +59,16 @@ Nebula Graph支持三种方式进行复合查询(或子查询): ```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 | - +---------+-------------+ + 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 0f005f7525..34d59faf6c 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 @@ nGQL扩展的自定义变量可以表示为`$var_name`,`var_name`由字母、 ## 示例 ```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 33a82c0bca..815b7983ca 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 @@ -60,7 +60,7 @@ $$.. ```ngql # 返回起始点的Tag player的name属性值和目的点的Tag player的age属性值。 -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 | +--------------+--------+ @@ -70,7 +70,7 @@ nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.pl +--------------+--------+ # 返回Edge type follow的degree属性值。 -nebula> GO FROM "player100" OVER follow YIELD follow.degree; +nebula> GO FROM "player100" OVER follow YIELD properties(edge).degree; +---------------+ | follow.degree | +---------------+ @@ -80,12 +80,12 @@ nebula> GO FROM "player100" OVER follow YIELD follow.degree; +---------------+ # 返回EdgeType 是 follow 的起始点 VID、目的点 VID、EdgeType 编码(正数为正向边,负数为逆向边),和边的 rank 值。 -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 e486484828..5badfa96f3 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,14 @@ 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 997a7c26f6..a5bbf53388 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 @@ nGQL和SQL之间的一个主要区别是子查询的组成方式。 ```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" | +-------------+ +... ``` 用户可以使用`YIELD`显式声明需要返回的结果,如果不使用`YIELD`,默认返回目标点ID。 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 b5f730b21b..d75a470266 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 @@ nGQL提供引用符来表示`WHERE`和`YIELD`子句中的属性,或者复合 ```ngql # 返回起始点和目的点的年龄。 -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 # 返回player100追随的player的名称和团队。 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 properties($^).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 d7edceb037..73407c1357 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 @@ -51,18 +51,20 @@ nebula> GO FROM "player102" OVER follow \ # UNION也可以和YIELD语句一起使用,去重时会检查每一行的所有列,每列都相同时才会去重。 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) ``` @@ -121,18 +123,22 @@ Empty set (time spent 2243/3259 us) ```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 @@ nebula> GO FROM "player102" OVER follow \ ```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; ``` 该查询中,圆括号包裹的部分先执行,即先执行`UNION`操作,再将结果结合管道符进行下一步操作。 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 a1b45669b6..5b9bb7ac0f 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,22 +47,22 @@ 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; -+----------------+------------------+----------------+--------------+ -| $^.player.name | serve.start_year | serve.end_year | $$.team.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; -+----------------+------------------+----------------+--------------+ -| $^.player.name | serve.start_year | serve.end_year | $$.team.name | -+----------------+------------------+----------------+--------------+ -| "Tony Parker" | 1999 | 2018 | "Spurs" | -+----------------+------------------+----------------+--------------+ +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; ++---------------------+-----------------------------+---------------------------+---------------------+ +| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).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, properties($$).name; ++---------------------+-----------------------------+---------------------------+---------------------+ +| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | ++---------------------+-----------------------------+---------------------------+---------------------+ +| "Tony Parker" | 1999 | 2018 | "Spurs" | ++---------------------+-----------------------------+---------------------------+---------------------+ ``` ### `(NOT) IN` 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 aea116c3d7..9e7e1ea1eb 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 @@ Nebula Graph支持以下内置数学函数。 ```ngql # 支持聚合函数 -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 1d6a59e82f..14d0f31baa 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 @@ -62,8 +62,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 6e459ba385..de585aa43e 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 @@ -35,7 +35,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 | +------------------------------+ @@ -97,7 +97,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 27f726bab5..921dcbd6d5 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" | ++-----------------+--------------+ ``` ## 通用形式 @@ -121,9 +121,9 @@ nebula> MATCH (v:player) WHERE v.age > 30 \ ```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 6fa5178aea..f749b96fbf 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 # 返回player101 follow的人,以及follow player101的人,即双向查询。 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 504d958187..1853a8898e 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 @@ -155,12 +155,12 @@ nebula> FETCH PROP ON serve "player100" -> "team204"; ```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 | ++-------------+------------+-------------+-----------------------------+ ``` ### 获取多条边的属性值 @@ -214,36 +214,36 @@ nebula> FETCH PROP ON serve "player100" -> "team204"@1; ```ngql # 返回从点player101开始的follow边的degree值。 nebula> 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 $-.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 properties(edge).degree; ++-------------+-------------+--------------+-------------------------+ +| follow._src | follow._dst | follow._rank | properties(EDGE).degree | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player100" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player102" | 0 | 90 | ++-------------+-------------+--------------+-------------------------+ +| "player101" | "player125" | 0 | 95 | ++-------------+-------------+--------------+-------------------------+ ``` 用户也可以通过自定义变量构建类似的查询。 ```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 | ++-------------+-------------+--------------+-------------------------+ ``` 更多复合语句的详情,请参见[复合查询(子句结构)](../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 0b4a226e98..bf78ce9d19 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 |\ + WHERE player.name == "Kobe Bryant" == "Kobe Bryant" \ + 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 d65e11fb84..dacbdc47af 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 @@ -42,7 +42,7 @@ nebula> MATCH (v:player)<-[:follow]-(:player) RETURN v.name AS Name, count(*) a ```ngql # 查找所有连接到player100的点,并根据他们的姓名进行分组,返回姓名的出现次数。 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; +---------------------+------------+ @@ -75,7 +75,7 @@ nebula> GO FROM "player100" OVER follow BIDIRECT \ ```ngql # 查找所有连接到player100的点,并根据起始点进行分组,返回degree的总和。 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 94ab6de562..cb87e926de 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 # 从排序结果中返回第2行开始的3行数据。 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 d411817086..fd906fe77d 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 35643bcec6..02c46f46ac 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"} | ++----------------------------------+ ``` ### 过滤属性 @@ -180,20 +179,20 @@ nebula> INSERT EDGE e1(p1) VALUES "1"->"2"@6:(16); # 通过rank过滤边,查找rank大于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 | ++-----------+-----------+------+---------------------+ ``` ## 过滤字符串 @@ -335,20 +334,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 | ++-------------+-------------------------+------------------------+ ``` ### 结合NOT使用 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 6f643e4a95..2350daebd6 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 e58ef4f3ef..d3a0969a45 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 @@ -30,7 +30,7 @@ Studio v{{ studio.release }} 及以后版本。请更新版本,详细操作参 查询语句示例如下: ```nGQL - nebula> GO FROM "player102" OVER serve YIELD serve._src,serve._dst; + nebula> GO FROM "player102" OVER serve YIELD src(edge),dst(edge); ``` 查询结果可以看到 `playerId` 为 `palyer102` 的球员服务球队的起始年份及终止年份。如下图所示。 From 80549cd5d91a90c42a59efb9ad1b6e84bbb5773f Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Tue, 19 Oct 2021 14:44:24 +0800 Subject: [PATCH 02/10] update --- docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7000c5a98f..b55e7e1ebf 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没有严格的构建格式要求,但根据恰当而统一的风格创建n 不推荐: ```ngql - GO FROM "player100" OVER follow REVERSELY YIELD dst(edge) AS id; + GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id; ``` 推荐: From bac8c524d3237e8d489f901849ad52ad3bd83540 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:11:54 +0800 Subject: [PATCH 03/10] update --- docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bf78ce9d19..ff54b15e19 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 @@ -116,7 +116,7 @@ nebula> LOOKUP ON player \ +-------------+-------------------------+------------------------+ nebula> LOOKUP ON player \ - WHERE player.name == "Kobe Bryant" == "Kobe Bryant" \ + WHERE player.name == "Kobe Bryant"\ YIELD properties(vertex).name AS name |\ GO FROM $-.VertexID OVER serve \ YIELD $-.name, properties(edge).start_year, properties(edge).end_year, properties($$).name; From 4f11bff3f82205932291653afbd0c8a5be9a9ea3 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Wed, 20 Oct 2021 10:09:55 +0800 Subject: [PATCH 04/10] update --- .../6.functions-and-expressions/4.schema.md | 50 +++++++++++++++---- 1 file changed, 40 insertions(+), 10 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 c577cceee5..3b9acdfc19 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,27 +1,57 @@ # Schema函数 -!!! note - - 本文介绍的函数仅适用于openCypher兼容语句。 - Nebula Graph支持以下Schema函数。 +## 原生nGQL语句适用 + |函数| 说明 | |:---- | :----| -| id(vertex) | 返回点ID。数据类型和点ID的类型保持一致。| -|list tags(vertex) | 返回点的Tag,与labels()作用相同。| -|list labels(vertex) | 返回点的Tag,与tags()作用相同,用于兼容openCypher语法。| -|map properties(vertex_or_edge) | 接收点或边并返回其属性。| +|id(vertex) | 返回点ID。数据类型和点ID的类型保持一致。| +|map properties(vertex) | 接收点并返回其属性。| +|map properties(edge) | 接收边并返回其属性。| |string type(edge) | 返回边的Edge type。| |src(edge)|返回边的起始点ID。数据类型和点ID的类型保持一致。| |dst(edge)|返回边的目的点ID。数据类型和点ID的类型保持一致。| -|vertex startNode(path) | 获取一条边或一条路径并返回它的起始点ID。| -|string endNode(path) | 获取一条边或一条路径并返回它的目的点ID。| |int rank(edge) | 返回边的rank。| +## openCypher兼容语句适用 + +|函数| 说明 | +|:---- | :----| +| id(\) | 返回点ID。数据类型和点ID的类型保持一致。| +|list tags(\) | 返回点的Tag,与labels()作用相同。| +|list labels(\) | 返回点的Tag,与tags()作用相同,用于兼容openCypher语法。| +|map properties(\) | 接收点或边并返回其属性。| +|string type(\) | 返回边的Edge type。| +|src(\)|返回边的起始点ID。数据类型和点ID的类型保持一致。| +|dst(\)|返回边的目的点ID。数据类型和点ID的类型保持一致。| +|vertex startNode(\) | 获取一条边或一条路径并返回它的起始点ID。| +|string endNode(\) | 获取一条边或一条路径并返回它的目的点ID。| +|int rank(\) | 返回边的rank。| + ## 示例 ```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 6dbcb6b7fb458bb1286e83a9e137c6edeb0fbe5b Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Wed, 20 Oct 2021 10:23:56 +0800 Subject: [PATCH 05/10] update --- .../3.ngql-guide/6.functions-and-expressions/4.schema.md | 6 ++++++ 1 file changed, 6 insertions(+) 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 3b9acdfc19..3dcf847ad9 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 @@ -4,6 +4,12 @@ Nebula Graph支持以下Schema函数。 ## 原生nGQL语句适用 +!!! note + + - GO语句中,WHERE子句和YIELD子句中可以使用如下函数。 + - LOOKUP语句中,YIELD子句中可以使用如下函数。 + - FETCH语句暂不支持如下函数。 + |函数| 说明 | |:---- | :----| |id(vertex) | 返回点ID。数据类型和点ID的类型保持一致。| From 12b0fb5e447afa78a5cab475b726bb2b02361f56 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Wed, 20 Oct 2021 10:55:59 +0800 Subject: [PATCH 06/10] update --- .../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 3dcf847ad9..5f8eed9aae 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 @@ -13,8 +13,8 @@ Nebula Graph支持以下Schema函数。 |函数| 说明 | |:---- | :----| |id(vertex) | 返回点ID。数据类型和点ID的类型保持一致。| -|map properties(vertex) | 接收点并返回其属性。| -|map properties(edge) | 接收边并返回其属性。| +|map properties(vertex) | 返回点的所有属性。| +|map properties(edge) | 返回边的所有属性。| |string type(edge) | 返回边的Edge type。| |src(edge)|返回边的起始点ID。数据类型和点ID的类型保持一致。| |dst(edge)|返回边的目的点ID。数据类型和点ID的类型保持一致。| @@ -27,7 +27,7 @@ Nebula Graph支持以下Schema函数。 | id(\) | 返回点ID。数据类型和点ID的类型保持一致。| |list tags(\) | 返回点的Tag,与labels()作用相同。| |list labels(\) | 返回点的Tag,与tags()作用相同,用于兼容openCypher语法。| -|map properties(\) | 接收点或边并返回其属性。| +|map properties(\) | 返回点或边的所有属性。| |string type(\) | 返回边的Edge type。| |src(\)|返回边的起始点ID。数据类型和点ID的类型保持一致。| |dst(\)|返回边的目的点ID。数据类型和点ID的类型保持一致。| From 0066eaff74cb0c2003538e66709acaff6ea9abcf Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Wed, 20 Oct 2021 16:21:41 +0800 Subject: [PATCH 07/10] update --- 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 5f8eed9aae..611f0d71fc 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 @@ -48,7 +48,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 035dccf7d380fd5abd6b6af0008a52830a0d34cf Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Thu, 21 Oct 2021 09:43:47 +0800 Subject: [PATCH 08/10] update --- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 25 +++++++++++-------- .../6.functions-and-expressions/4.schema.md | 2 +- .../7.general-query-statements/2.match.md | 2 +- .../7.general-query-statements/3.go.md | 2 +- .../7.general-query-statements/4.fetch.md | 2 +- .../8.clauses-and-options/order-by.md | 2 +- .../8.clauses-and-options/yield.md | 4 +-- .../use-console/st-ug-open-in-explore.md | 2 +- 8 files changed, 22 insertions(+), 19 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 8b1343a3dd..15f2fb83ce 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 @@ Execution succeeded (time spent 5858/6870 us) ```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 @@ Execution succeeded (time spent 5858/6870 us) - 查询Tag属性 ```ngql - FETCH PROP ON { | | *} - [YIELD [DISTINCT] ]; + FETCH PROP ON {[, tag_name ...] | *} + [, vid ...] + [YIELD [AS ]]; ``` - 查询边属性 ```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 611f0d71fc..723598ca93 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 @@ -8,7 +8,7 @@ Nebula Graph支持以下Schema函数。 - GO语句中,WHERE子句和YIELD子句中可以使用如下函数。 - LOOKUP语句中,YIELD子句中可以使用如下函数。 - - FETCH语句暂不支持如下函数。 + - FETCH语句中,YIELD子句中可以使用如下函数。 |函数| 说明 | |:---- | :----| 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 e0e8769dcc..a153a53237 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 @@ 与`GO`或`LOOKUP`等其他查询语句相比,`MATCH`的语法更灵活。`MATCH`语法可以概括如下: ```ngql -MATCH [] RETURN +MATCH [] RETURN ; ``` ## 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 3eeb74d47f..193e00c0af 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 @@ -15,7 +15,7 @@ OVER [{REVERSELY | BIDIRECT}] [YIELD [DISTINCT] ] [| GROUP BY {col_name | expr | position} YIELD ] [| ORDER BY [{ASC | DESC}]] -[| LIMIT [,] ] +[| 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 1853a8898e..3c3ff6ced1 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 @@ nebula> FETCH PROP ON player "player100"; ```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/order-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md index fd906fe77d..8023384e64 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 @@ -26,7 +26,7 @@ ORDER BY [ASC | DESC] [, [ASC | DESC] ...]; ```ngql nebula> FETCH PROP ON player "player100", "player101", "player102", "player103" \ - YIELD player.age AS age, player.name AS name \ + YIELD properties(vertex).age AS age, properties(vertex).name AS name \ | ORDER BY $-.age ASC, $-.name DESC; +-------------+-----+---------------------+ | VertexID | age | 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 2350daebd6..6a992e643e 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 | +-------------+--------------+ @@ -104,7 +104,7 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...] nebula> GO FROM "player100" OVER follow \ YIELD dst(edge) 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 d3a0969a45..ffeb8e77cc 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 @@ Studio v{{ studio.release }} 及以后版本。请更新版本,详细操作参 查询语句示例如下: ```nGQL - nebula> FETCH PROP ON player "player100" YIELD player.name; + nebula> FETCH PROP ON player "player100" YIELD properties(vertex).name; ``` 查询得到 `playerId` 为 `player100` 的球员信息。如下图所示。 From 5cdefb48f5be4c04e2b96cc6d642d2b24a467a2d Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Thu, 21 Oct 2021 10:25:43 +0800 Subject: [PATCH 09/10] update --- docs-2.0/2.quick-start/4.nebula-graph-crud.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 15f2fb83ce..1893c094bc 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 @@ -291,7 +291,7 @@ Execution succeeded (time spent 5858/6870 us) ```ngql FETCH PROP ON -> [@] [, -> ...] - [YIELD ] + [YIELD ]; ``` - `LOOKUP` From 9a0cb16be1d9d16216a02c484e71c6f78a5f5ab3 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Thu, 21 Oct 2021 13:34:12 +0800 Subject: [PATCH 10/10] update --- .../8.clauses-and-options/yield.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 6a992e643e..f2289cc1ca 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 @@ -60,11 +60,11 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...]; ```ngql nebula> FETCH PROP ON player "player100" \ YIELD properties(vertex).name; - +-------------+--------------+ - | VertexID | player.name | - +-------------+--------------+ - | "player100" | "Tim Duncan" | - +-------------+--------------+ + +-------------+-------------------------+ + | VertexID | properties(VERTEX).name | + +-------------+-------------------------+ + | "player100" | "Tim Duncan" | + +-------------+-------------------------+ ``` - `LOOKUP`语句中使用`YIELD`: @@ -72,11 +72,11 @@ YIELD [DISTINCT] [AS ] [, [AS ] ...]; ```ngql nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ YIELD properties(vertex).name, properties(vertex).age; - +-------------+---------------+------------+ - | VertexID | player.name | player.age | - +-------------+---------------+------------+ - | "player101" | "Tony Parker" | 36 | - +-------------+---------------+------------+ + +-------------+-------------------------+------------------------+ + | VertexID | properties(VERTEX).name | properties(VERTEX).age | + +-------------+-------------------------+------------------------+ + | "player101" | "Tony Parker" | 36 | + +-------------+-------------------------+------------------------+ ``` ## YIELD语句