Skip to content

Commit

Permalink
fix:Update 3.go.md&1.overview.md【zh&en】 (#2579)
Browse files Browse the repository at this point in the history
* 【zh】Update 1.overview.md

给出的nGQL语法和语句示例不符

* 【en】Update 1.overview.md

给出的nGQL语法和语句示例不符

* 【zh】Update 3.go.md

子查询id作为起点:
go查询语句中src改为dst
match查询语句中①更改边的方向和上面结果保持一致②增加age条件

* 【en】Update 3.go.md

子查询id作为起点:
go查询语句中src改为dst
match查询语句中①更改边的方向和上面结果保持一致②增加age条件

* Update docs-2.0-zh/3.ngql-guide/7.general-query-statements/3.go.md

* Update docs-2.0-en/3.ngql-guide/7.general-query-statements/3.go.md

---------

Co-authored-by: abby.huang <78209557+abby-cyber@users.noreply.github.com>
  • Loading branch information
n3A87 and abby-cyber authored Jul 22, 2024
1 parent 5bf23d3 commit dddf2bc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
3 changes: 2 additions & 1 deletion docs-2.0-en/3.ngql-guide/1.nGQL-overview/1.overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ For details of the symbols in nGQL syntax, see the following table:
| \| | complete alternative elements |
| ... | may be repeated any number of times |

For example, create vertices in nGQL syntax:
For example, insert vertices in nGQL syntax:

```ngql
INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...]
Expand All @@ -67,6 +67,7 @@ Example statement:

```ngql
nebula> CREATE TAG IF NOT EXISTS player(name string, age int);
nebula> INSERT VERTEX IF NOT EXISTS player(name,age) VALUES "player100":("Tim Duncan", 42);
```

## About openCypher compatibility
Expand Down
33 changes: 17 additions & 16 deletions docs-2.0-en/3.ngql-guide/7.general-query-statements/3.go.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,30 +218,31 @@ nebula> MATCH (v)<-[e:follow]- (v2) WHERE id(v) == 'player100' \

```ngql
# Return the friends of the player100 vertex and the teams that the friends belong to.
nebula> GO FROM "player100" OVER follow REVERSELY \
YIELD src(edge) AS id | \
nebula> GO FROM "player100" OVER follow \
YIELD dst(edge) AS id | \
GO FROM $-.id OVER serve \
WHERE properties($^).age > 20 \
YIELD properties($^).name AS FriendOf, properties($$).name AS Team;
YIELD properties($^).name AS Friend, properties($$).name AS Team;
+---------------------+-----------------+
| FriendOf | Team |
| Friend | Team |
+---------------------+-----------------+
| "Tony Parker" | "Spurs" |
| "Tony Parker" | "Hornets" |
| "Manu Ginobili" | "Spurs" |
+---------------------+-----------------+
| "Boris Diaw" | "Spurs" |
| "Boris Diaw" | "Jazz" |
| "Boris Diaw" | "Suns" |
...
# The following MATCH query has the same semantics as the previous GO query.
nebula> MATCH (v)<-[e:follow]- (v2)-[e2:serve]->(v3) \
nebula> MATCH (v)-[e:follow]-> (v2)-[e2:serve]->(v3) \
WHERE id(v) == 'player100' \
RETURN v2.player.name AS FriendOf, v3.team.name AS Team;
AND properties(v2).age > 20 \
RETURN v2.player.name AS Friend, v3.team.name AS Team;
+---------------------+-----------------+
| FriendOf | Team |
| Friend | Team |
+---------------------+-----------------+
| "Tony Parker" | "Spurs" |
| "Tony Parker" | "Hornets" |
| "Manu Ginobili" | "Spurs" |
+---------------------+-----------------+
| "Boris Diaw" | "Spurs" |
| "Boris Diaw" | "Jazz" |
| "Boris Diaw" | "Suns" |
...
```

### To use `GROUP BY` to group the output
Expand Down Expand Up @@ -290,4 +291,4 @@ nebula> GO FROM "player100" OVER follow WHERE properties($$).name IS NOT EMPTY Y
| "player125" |
| "player101" |
+-------------+
```
```
3 changes: 2 additions & 1 deletion docs-2.0-zh/3.ngql-guide/1.nGQL-overview/1.overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ nGQL 是一个进行中的项目,会持续发布新特性和优化,因此可
| \| | 所有可选的元素。 |
| ... | 可以重复多次。 |

例如创建点的 nGQL 语法:
例如插入一个点的 nGQL 语法:

```ngql
INSERT VERTEX [IF NOT EXISTS] [tag_props, [tag_props] ...]
Expand All @@ -74,6 +74,7 @@ prop_value_list:

```ngql
nebula> CREATE TAG IF NOT EXISTS player(name string, age int);
nebula> INSERT VERTEX IF NOT EXISTS player(name,age) VALUES "player100":("Tim Duncan", 42);
```

## 关于 openCypher 兼容性
Expand Down
22 changes: 12 additions & 10 deletions docs-2.0-zh/3.ngql-guide/7.general-query-statements/3.go.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,30 @@ nebula> MATCH (v)<-[e:follow]- (v2) WHERE id(v) == 'player100' \
```ngql
# 查询 player100 年龄大于 20 的朋友和这些朋友所属队伍。
nebula> GO FROM "player100" OVER follow \
YIELD src(edge) AS id | \
YIELD dst(edge) AS id | \
GO FROM $-.id OVER serve \
WHERE properties($^).age > 20 \
YIELD properties($^).name AS Friend, properties($$).name AS Team;
+---------------------+-----------------+
| Friend | Team |
+---------------------+-----------------+
| "Tim Duncan" | "Spurs" |
| "Tim Duncan" | "Spurs" |
| "Tony Parker" | "Spurs" |
| "Tony Parker" | "Hornets" |
| "Manu Ginobili" | "Spurs" |
+---------------------+-----------------+
# 该 MATCH 查询与上一个 GO 查询具有相同的语义。
nebula> MATCH (v)<-[e:follow]- (v2)-[e2:serve]->(v3) \
nebula> MATCH (v)-[e:follow]-> (v2)-[e2:serve]->(v3)  \
WHERE id(v) == 'player100' \
RETURN v2.player.name AS FriendOf, v3.team.name AS Team;
AND properties(v2).age > 20 \
RETURN v2.player.name AS Friend, v3.team.name AS Team;
+---------------------+-----------------+
| FriendOf | Team |
| Friend | Team |
+---------------------+-----------------+
| "Tony Parker" | "Spurs" |
| "Tony Parker" | "Hornets" |
| "Manu Ginobili" | "Spurs" |
+---------------------+-----------------+
| "Boris Diaw" | "Spurs" |
| "Boris Diaw" | "Jazz" |
| "Boris Diaw" | "Suns" |
...
```

### 使用 GROUP BY 分组
Expand Down

0 comments on commit dddf2bc

Please sign in to comment.