Skip to content

Commit

Permalink
change where clause in go statement (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper-lzy committed Dec 7, 2021
1 parent 605d76b commit 6eb5161
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs-2.0/2.quick-start/4.nebula-graph-crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ nebula> CREATE EDGE serve(start_year int, end_year int);
- 从 VID 为`player101`的球员开始,沿着边`follow`查找年龄大于或等于 35 岁的球员,并返回他们的姓名和年龄,同时重命名对应的列。

```ngql
nebula> GO FROM "player101" OVER follow WHERE properties($$).age >= 35 \
nebula> GO FROM "player101" OVER follow WHERE $$.player.age >= 35 \
YIELD properties($$).name AS Teammate, properties($$).age AS Age;
+--------------+-----+
| Teammate | Age |
Expand Down
4 changes: 2 additions & 2 deletions docs-2.0/2.quick-start/6.cheatsheet-for-ngql-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@
| ------------------------------------------------------------ | ------------------------------------------------------- |
| `GO FROM "player102" OVER serve` | 返回 player102 所属队伍。 |
| `GO 2 STEPS FROM "player102" OVER follow` | 返回距离 player102 两跳的朋友。 |
| `GO FROM "player100", "player102" OVER serve WHERE properties(edge).start_year > 1995 YIELD DISTINCT properties($$).name AS team_name, properties(edge).start_year AS start_year, properties($^).name AS player_name` | 添加过滤条件。 |
| `GO FROM "player100", "player102" OVER serve WHERE serve.start_year > 1995 YIELD DISTINCT properties($$).name AS team_name, properties(edge).start_year AS start_year, properties($^).name AS player_name` | 添加过滤条件。 |
| `GO FROM "player100" OVER follow, serve YIELD properties(edge).degree, properties(edge).start_year` | 遍历多个 Edge type。属性没有值时,会显示`UNKNOWN_PROP`|
| `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS destination` | 返回 player100 入方向的邻居点。 |
| `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` | 查询 player100 的朋友和朋友所属队伍。 |
| `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id | GO FROM $-.id OVER serve WHERE $^.player.age > 20 YIELD properties($^).name AS FriendOf, properties($$).name AS Team` | 查询 player100 的朋友和朋友所属队伍。 |
| `GO FROM "player102" OVER follow YIELD dst(edge) AS both` | 返回 player102 所有邻居点。 |
| `GO 2 STEPS FROM "player100" OVER follow YIELD src(edge) AS src, dst(edge) AS dst, properties($$).age AS age | GROUP BY $-.dst YIELD $-.dst AS dst, collect_set($-.src) AS src, collect($-.age) AS age` | 根据年龄分组。 |

Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ 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]
WHERE follow.degree IN [v IN [95,99] WHERE v > 0]
YIELD dst(edge), properties(edge).degree
"""
Then the result should be, in any order:
Expand Down
4 changes: 2 additions & 2 deletions docs-2.0/3.ngql-guide/1.nGQL-overview/ngql-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nGQL 没有严格的构建格式要求,但根据恰当而统一的风格创建

```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;
OVER serve WHERE $^.player.age > 20 YIELD properties($^).name AS FriendOf, properties($$).name AS Team;
```

推荐:
Expand All @@ -40,7 +40,7 @@ nGQL 没有严格的构建格式要求,但根据恰当而统一的风格创建
OVER follow REVERSELY \
YIELD src(edge) AS id | \
GO FROM $-.id OVER serve \
WHERE properties($^).age > 20 \
WHERE $^.player.age > 20 \
YIELD properties($^).name AS FriendOf, properties($$).name AS Team;
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ nebula> DELETE VERTEX "team1";

```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 dst(edge) AS id | DELETE VERTEX $-.id;
```

## 删除过程与删除邻边
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/3.data-types/6.list.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ nebula> RETURN size([1,2,3]);
+---------------+
# 将列表 [92,90] 中的元素做运算,然后在 where 子句中进行条件判断。
nebula> GO FROM "player100" OVER follow WHERE properties(edge).degree NOT IN [x IN [92, 90] | x + $$.player.age] \
nebula> GO FROM "player100" OVER follow WHERE follow.degree NOT IN [x IN [92, 90] | x + $$.player.age] \
YIELD dst(edge) AS id, properties(edge).degree AS degree;
+-------------+--------+
| id | degree |
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/5.operators/1.comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ 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 dst(edge);
+-------------+
| dst(EDGE) |
+-------------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ 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) \
WHERE follow.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 |
Expand Down
6 changes: 3 additions & 3 deletions docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ nebula> GO 2 STEPS FROM "player102" OVER follow;
```ngql
# 添加过滤条件。
nebula> GO FROM "player100", "player102" OVER serve \
WHERE properties(edge).start_year > 1995 \
WHERE serve.start_year > 1995 \
YIELD DISTINCT properties($$).name AS team_name, properties(edge).start_year AS start_year, properties($^).name AS player_name;
+-----------------+------------+---------------------+
Expand Down Expand Up @@ -146,7 +146,7 @@ nebula> MATCH (v)<-[e:follow]- (v2) WHERE id(v) == 'player100' \
nebula> GO FROM "player100" OVER follow REVERSELY \
YIELD src(edge) AS id | \
GO FROM $-.id OVER serve \
WHERE properties($^).age > 20 \
WHERE $^.player.age > 20 \
YIELD properties($^).name AS FriendOf, properties($$).name AS Team;
+---------------------+-----------------+
| FriendOf | Team |
Expand Down Expand Up @@ -223,7 +223,7 @@ nebula> $a = GO FROM "player100" OVER follow YIELD src(edge) AS src, dst(edge) A

```ngql
# 在多个边上通过 IS NOT EMPTY 进行判断。
nebula> GO FROM "player100" OVER follow WHERE properties($$).name IS NOT EMPTY YIELD dst(edge);
nebula> GO FROM "player100" OVER follow WHERE $$.player.name IS NOT EMPTY YIELD dst(edge);
+-------------+
| dst(EDGE) |
+-------------+
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/8.clauses-and-options/where.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ nebula> MATCH (v:player) \
```ngql
nebula> GO FROM "player100" \
OVER follow \
WHERE properties(edge).degree > 90 \
WHERE follow.degree > 90 \
OR properties($$).age != 33 \
AND properties($$).name != "Tony Parker" \
YIELD properties($$);
Expand Down

0 comments on commit 6eb5161

Please sign in to comment.