-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51fd34a
commit 1b931fe
Showing
4 changed files
with
121 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,9 @@ INT8 | |
INTERSECT | ||
IS | ||
LIMIT | ||
LIST | ||
LOOKUP | ||
MAP | ||
MATCH | ||
MINUS | ||
NO | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,57 @@ | ||
# 集合 | ||
|
||
集合(Set)是复合数据类型。 | ||
集合(Set)是复合数据类型,集合中是一组元素,与列表(List)不同的是,集合中的元素是无序的,且不允许重复。 | ||
|
||
集合用左花括号({)和右花括号(})包裹多个元素,各个元素之间用英文逗号(,)隔开。元素前后的空格在集合中被忽略,因此可以使用换行符、制表符和空格调整格式。 | ||
|
||
## OpenCypher 兼容性 | ||
|
||
在 OpenCypher 中,集合不是一个数据类型,而在 nGQL 中,集合仍在设计阶段。 | ||
- 复合数据类型(例如 List、Set、Map)**不能**存储为点或边的属性。 | ||
|
||
- 在 OpenCypher 中,集合不是一个数据类型,而在 nGQL 中,用户可以使用集合。 | ||
|
||
## 示例 | ||
|
||
```ngql | ||
# 返回集合 {1,2,3}。 | ||
nebula> RETURN set{1, 2, 3} AS a; | ||
+-----------+ | ||
| a | | ||
+-----------+ | ||
| {3, 2, 1} | | ||
+-----------+ | ||
# 返回集合 {1,2,1},因为集合不允许重复元素,会返回 {1,2},且顺序是无序的。 | ||
nebula> RETURN set{1, 2, 1} AS a; | ||
+--------+ | ||
| a | | ||
+--------+ | ||
| {2, 1} | | ||
+--------+ | ||
# 判断集合中是否有指定元素 1。 | ||
nebula> RETURN 1 IN set{1, 2} AS a; | ||
+------+ | ||
| a | | ||
+------+ | ||
| true | | ||
+------+ | ||
# 计算集合中的元素数量。 | ||
nebula> YIELD size(set{1, 2, 1}) AS a; | ||
+---+ | ||
| a | | ||
+---+ | ||
| 2 | | ||
+---+ | ||
# 返回目标点属性值组成的集合。 | ||
nebula> GO FROM "player100" OVER follow \ | ||
YIELD set{properties($$).name,properties($$).age} as a; | ||
+-----------------------+ | ||
| a | | ||
+-----------------------+ | ||
| {36, "Tony Parker"} | | ||
| {41, "Manu Ginobili"} | | ||
+-----------------------+ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters