From bc09aa3dc298313da91d81cce40286f8bb987588 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Thu, 14 Oct 2021 17:03:00 +0800 Subject: [PATCH 1/2] lookup format --- .../1.nGQL-overview/keywords-and-reserved-words.md | 1 + .../3.ngql-guide/7.general-query-statements/5.lookup.md | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs-2.0/3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md b/docs-2.0/3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md index 9ba47a7e438..964a72fb5df 100644 --- a/docs-2.0/3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md +++ b/docs-2.0/3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md @@ -43,6 +43,7 @@ RETURN DESCRIBE DESC VERTEX +VERTICES EDGE EDGES UPDATE 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 a57fd4127d4..fc56f2d44de 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 @@ -1,5 +1,7 @@ # LOOKUP + + `LOOKUP`根据索引遍历数据。用户可以使用`LOOKUP`实现如下功能: - 根据`WHERE`子句搜索特定数据。 @@ -43,11 +45,10 @@ LOOKUP ON { | } - `WHERE `:指定遍历的过滤条件,还可以结合布尔运算符AND和OR一起使用。详情请参见[WHERE](../8.clauses-and-options/where.md)。 -- `YIELD `:指定要返回的结果和格式。 +- `YIELD`:定义需要返回的输出。 -- 如果只有`WHERE`子句,没有`YIELD`子句: - - `LOOKUP`Tag时,返回点ID。 - - `LOOKUP`Edge type时,返回起始点ID、目的点ID和rank。 + - `LOOKUP`Tag时,除了返回定义的属性,额外返回`VertexID`。如果没有`YIELD`子句,返回`VertexID`。 + - `LOOKUP`Edge type时,除了返回定义的属性,额外返回`起始点ID`、`目的点ID`和`rank`。如果没有`YIELD`子句,返回`起始点ID`、`目的点ID`和`rank`。 ## WHERE语句限制 From 5a35957b70983ac2d311baefec9cc31e428e623b Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Thu, 14 Oct 2021 17:08:07 +0800 Subject: [PATCH 2/2] update --- .../7.general-query-statements/5.lookup.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 fc56f2d44de..0b4a226e988 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 @@ -37,7 +37,7 @@ ```ngql LOOKUP ON { | } [WHERE [AND ...]] -[YIELD ]; +[YIELD [AS ]]; [AS ] [, [AS ] ...]; @@ -50,6 +50,8 @@ LOOKUP ON { | } - `LOOKUP`Tag时,除了返回定义的属性,额外返回`VertexID`。如果没有`YIELD`子句,返回`VertexID`。 - `LOOKUP`Edge type时,除了返回定义的属性,额外返回`起始点ID`、`目的点ID`和`rank`。如果没有`YIELD`子句,返回`起始点ID`、`目的点ID`和`rank`。 +- `AS`:设置别名。 + ## WHERE语句限制 在`LOOKUP`语句中使用`WHERE`子句,不支持如下操作: @@ -84,12 +86,12 @@ nebula> LOOKUP ON player \ nebula> LOOKUP ON player \ WHERE player.name == "Tony Parker" \ - YIELD player.name, player.age; -+-------------+---------------+------------+ -| VertexID | player.name | player.age | -+-------------+---------------+------------+ -| "player101" | "Tony Parker" | 36 | -+-------------+---------------+------------+ + YIELD player.name AS name, player.age AS age; ++-------------+---------------+-----+ +| VertexID | name | age | ++-------------+---------------+-----+ +| "player101" | "Tony Parker" | 36 | ++-------------+---------------+-----+ nebula> LOOKUP ON player \ WHERE player.age > 45;