Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new console table format in example #1102

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions docs-2.0/2.quick-start/4.nebula-graph-crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ nebula> SHOW HOSTS;
| Host | Port | Status | Leader count | Leader distribution | Partition distribution |
+-------------+-----------+-----------+--------------+----------------------+------------------------+
| "storaged0" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
+-------------+-----------+-----------+--------------+----------------------+------------------------+
| "storaged1" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
+-------------+-----------+-----------+--------------+----------------------+------------------------+
| "storaged2" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
+-------------+-----------+-----------+--------------+----------------------+------------------------+
| "Total" | __EMPTY__ | __EMPTY__ | 0 | __EMPTY__ | __EMPTY__ |
+-------------+-----------+-----------+--------------+----------------------+------------------------+
Got 4 rows (time spent 1061/2251 us)
Expand All @@ -51,7 +48,7 @@ Got 4 rows (time spent 1061/2251 us)

### 异步实现创建和修改

!!! caution
!!! caution

Nebula Graph中执行如下创建和修改操作,是异步实现的。要在**下一个**心跳周期之后才能生效;否则访问会报错。

Expand Down Expand Up @@ -81,7 +78,7 @@ Got 4 rows (time spent 1061/2251 us)

```ngql
CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
[partition_num = <partition_number>,]
[partition_num = <partition_number>,]
[replica_factor = <replica_number>,]
vid_type = {FIXED_STRING(<N>) | INT64}
)
Expand Down Expand Up @@ -124,11 +121,8 @@ Got 4 rows (time spent 1061/2251 us)
| Host | Port | Status | Leader count | Leader distribution | Partition distribution |
+-------------+-----------+-----------+--------------+----------------------------------+------------------------+
| "storaged0" | 9779 | "ONLINE" | 5 | "basketballplayer:5" | "basketballplayer:5" |
+-------------+-----------+-----------+--------------+----------------------------------+------------------------+
| "storaged1" | 9779 | "ONLINE" | 5 | "basketballplayer:5" | "basketballplayer:5" |
+-------------+-----------+-----------+--------------+----------------------------------+------------------------+
| "storaged2" | 9779 | "ONLINE" | 5 | "basketballplayer:5" | "basketballplayer:5" |
+-------------+-----------+-----------+--------------+----------------------------------+------------------------+
| "Total" | | | 15 | "basketballplayer:15" | "basketballplayer:15" |
+-------------+-----------+-----------+--------------+----------------------------------+------------------------+
Got 4 rows (time spent 1633/2867 us)
Expand Down Expand Up @@ -283,9 +277,9 @@ Execution succeeded (time spent 5858/6870 us)
- 查询Tag属性

```ngql
FETCH PROP ON {<tag_name>[, tag_name ...] | *}
<vid> [, vid ...]
[YIELD <return_list> [AS <alias>]];
FETCH PROP ON {<tag_name>[, tag_name ...] | *}
<vid> [, vid ...]
[YIELD <return_list> [AS <alias>]];
```

- 查询边属性
Expand All @@ -298,8 +292,8 @@ Execution succeeded (time spent 5858/6870 us)
- `LOOKUP`

```ngql
LOOKUP ON {<vertex_tag> | <edge_type>}
[WHERE <expression> [AND <expression> ...]]
LOOKUP ON {<vertex_tag> | <edge_type>}
[WHERE <expression> [AND <expression> ...]]
[YIELD <return_list> [AS <alias>]];
```

Expand All @@ -319,7 +313,6 @@ Execution succeeded (time spent 5858/6870 us)
| follow._dst |
+-------------+
| "player101" |
+-------------+
| "player125" |
+-------------+
Got 2 rows (time spent 12097/14220 us)
Expand All @@ -334,7 +327,6 @@ Execution succeeded (time spent 5858/6870 us)
| Teammate | Age |
+-----------------+-----+
| "Tony Parker" | 36 |
+-----------------+-----+
| "Manu Ginobili" | 41 |
+-----------------+-----+
```
Expand All @@ -357,13 +349,11 @@ Execution succeeded (time spent 5858/6870 us)
| Team | Player |
+-----------+-----------------+
| "Spurs" | "Tony Parker" |
+-----------+-----------------+
| "Hornets" | "Tony Parker" |
+-----------+-----------------+
| "Spurs" | "Manu Ginobili" |
+-----------+-----------------+
```

|子句/符号|说明|
|:---|:---|
| `$^` |表示边的起点。|
Expand All @@ -384,9 +374,7 @@ Execution succeeded (time spent 5858/6870 us)
| Team | Player |
+-----------+-----------------+
| "Spurs" | "Tony Parker" |
+-----------+-----------------+
| "Hornets" | "Tony Parker" |
+-----------+-----------------+
| "Spurs" | "Manu Ginobili" |
+-----------+-----------------+
```
Expand Down Expand Up @@ -540,7 +528,7 @@ nebula> FETCH PROP ON player "player100";
- 创建索引

```ngql
CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] <index_name>
CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] <index_name>
ON {<tag_name> | <edge_name>} ([<prop_name_list>]) [COMMENT = '<comment>'];
```

Expand All @@ -560,7 +548,7 @@ nebula> REBUILD TAG INDEX player_index_0;
```

!!! Note

为没有指定长度的变量属性创建索引时,需要指定索引长度。在utf-8编码中,一个中文字符占3字节,请根据变量属性长度设置合适的索引长度。例如10个中文字符,索引长度需要为30。详情请参见[创建索引](../3.ngql-guide/14.native-index-statements/1.create-native-index.md#_6)。

### 基于索引的`LOOKUP`和`MATCH`示例
Expand Down
3 changes: 1 addition & 2 deletions docs-2.0/3.ngql-guide/10.tag-statements/4.show-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ nebula> SHOW TAGS;
| Name |
+----------+
| "player" |
+----------+
| "team" |
+----------+
```
```
1 change: 0 additions & 1 deletion docs-2.0/3.ngql-guide/10.tag-statements/5.describe-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ nebula> DESCRIBE TAG player;
| Field | Type | Null | Default | Comment |
+--------+----------+-------+---------+---------+
| "name" | "string" | "YES" | | |
+--------+----------+-------+---------+---------+
| "age" | "int64" | "YES" | | |
+--------+----------+-------+---------+---------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ nebula> SHOW EDGES;
| Name |
+----------+
| "follow" |
+----------+
| "serve" |
+----------+
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ nebula> SHOW TAG INDEXES;
| Index Name | By Tag | Columns |
+------------------+--------------+-----------------+
| "fix" | "fix_string" | ["p1"] |
+------------------+--------------+-----------------+
| "player_index_0" | "player" | ["name"] |
+------------------+--------------+-----------------+
| "player_index_1" | "player" | ["name", "age"] |
+------------------+--------------+-----------------+
| "var" | "var_string" | ["p1"] |
+------------------+--------------+-----------------+

Expand All @@ -35,4 +32,4 @@ nebula> SHOW EDGE INDEXES;

!!! Compatibility "历史版本兼容性"

Nebula Graph 2.0.1中, `SHOW TAG/EDGE INDEXES` 语句仅返回 `Names`。
Nebula Graph 2.0.1中, `SHOW TAG/EDGE INDEXES` 语句仅返回 `Names`。
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ nebula> DESCRIBE TAG INDEX player_index_1;
| Field | Type |
+--------+--------------------+
| "name" | "fixed_string(10)" |
+--------+--------------------+
| "age" | "int64" |
+--------+--------------------+
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ nebula> SHOW JOB 31;
| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time |
+----------------+---------------------+------------+-------------------------+-------------------------+
| 31 | "REBUILD_TAG_INDEX" | "FINISHED" | 2021-07-07T09:04:24.000 | 2021-07-07T09:04:24.000 |
+----------------+---------------------+------------+-------------------------+-------------------------+
| 0 | "storaged1" | "FINISHED" | 2021-07-07T09:04:24.000 | 2021-07-07T09:04:28.000 |
+----------------+---------------------+------------+-------------------------+-------------------------+
| 1 | "storaged2" | "FINISHED" | 2021-07-07T09:04:24.000 | 2021-07-07T09:04:28.000 |
+----------------+---------------------+------------+-------------------------+-------------------------+
| 2 | "storaged0" | "FINISHED" | 2021-07-07T09:04:24.000 | 2021-07-07T09:04:28.000 |
+----------------+---------------------+------------+-------------------------+-------------------------+
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ nebula> SHOW TAG INDEX STATUS;
| Name | Index Status |
+----------------------+--------------+
| "player_index_0" | "FINISHED" |
+----------------------+--------------+
| "player_index_1" | "FINISHED" |
+----------------------+--------------+
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ LOOKUP ON {<tag> | <edge_type>} WHERE <expression> [YIELD <return_list>];
- `fuzziness`:可选项。允许匹配的最大编辑距离。默认值为`AUTO`。查看其他可选值和更多信息,请参见[Elasticsearch官方文档](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/common-options.html#fuzziness)。

- `operator`:可选项。解释文本的布尔逻辑。可选值为`OR`(默认)和`and`。

- `row_limit`:可选项。指定要返回的行数。默认值为`100`。

- `timeout`:可选项。指定超时时间。单位:毫秒(ms)。默认值为`200`。
Expand Down Expand Up @@ -128,9 +128,7 @@ nebula> LOOKUP ON player WHERE PREFIX(player.name, "B");
| _vid |
+-----------------+
| "Boris Diaw" |
+-----------------+
| "Ben Simmons" |
+-----------------+
| "Blake Griffin" |
+-----------------+

Expand All @@ -139,9 +137,7 @@ nebula> LOOKUP ON player WHERE WILDCARD(player.name, "*ri*") YIELD player.name,
| _vid | name | age |
+-----------------+-----------------+-----+
| "Chris Paul" | "Chris Paul" | 33 |
+-----------------+-----------------+-----+
| "Boris Diaw" | "Boris Diaw" | 36 |
+-----------------+-----------------+-----+
| "Blake Griffin" | "Blake Griffin" | 30 |
+-----------------+-----------------+-----+

Expand All @@ -164,9 +160,7 @@ nebula> LOOKUP ON player WHERE REGEXP(player.name, ".*");
| _vid |
+---------------------+
| "Danny Green" |
+---------------------+
| "David West" |
+---------------------+
| "Russell Westbrook" |
+---------------------+
...
Expand Down
4 changes: 0 additions & 4 deletions docs-2.0/3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ GET SUBGRAPH [WITH PROP] [<step_count> STEPS] FROM {<vid>, <vid>...}
| nodes | relationships |
+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| [("player100" :player{})] | [[:follow "player100"->"player101" @0 {}], [:follow "player100"->"player102" @0 {}], [:serve "player100"->"team200" @0 {}]] |
+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| [("player101" :player{}), ("player102" :player{}), ("team200" :team{})] | [[:follow "player102"->"player101" @0 {}]] |
+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
```
Expand All @@ -55,7 +54,6 @@ GET SUBGRAPH [WITH PROP] [<step_count> STEPS] FROM {<vid>, <vid>...}
| nodes | relationships |
+---------------------------+---------------+
| [("player100" :player{})] | [] |
+---------------------------+---------------+
| [] | [] |
+---------------------------+---------------+
```
Expand All @@ -70,7 +68,6 @@ GET SUBGRAPH [WITH PROP] [<step_count> STEPS] FROM {<vid>, <vid>...}
| nodes | relationships |
+------------------------------------------------------+-------------------------------------------------------------------------+
| [("player100" :player{age: 42, name: "Tim Duncan"})] | [[:serve "player100"->"team200" @0 {end_year: 2016, start_year: 1997}]] |
+------------------------------------------------------+-------------------------------------------------------------------------+
| [("team200" :team{name: "Warriors"})] | [] |
+------------------------------------------------------+-------------------------------------------------------------------------+
```
Expand Down Expand Up @@ -108,7 +105,6 @@ nebula> GET SUBGRAPH 100 STEPS FROM "player141" OUT follow YIELD VERTICES AS nod
| nodes | relationships |
+---------------------------+--------------------------------------------+
| [("player141" :player{})] | [[:follow "player141"->"player124" @0 {}]] |
+---------------------------+--------------------------------------------+
| [("player124" :player{})] | [[:follow "player124"->"player141" @0 {}]] |
+---------------------------+--------------------------------------------+
```
6 changes: 0 additions & 6 deletions docs-2.0/3.ngql-guide/16.subgraph-and-path/2.find-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ nebula> FIND ALL PATH FROM "player100" TO "team204" OVER * WHERE follow.degree i
| path |
+------------------------------------------------------------------------------+
| <("player100")-[:serve@0 {}]->("team204")> |
+------------------------------------------------------------------------------+
| <("player100")-[:follow@0 {}]->("player125")-[:serve@0 {}]->("team204")> |
+------------------------------------------------------------------------------+
| <("player100")-[:follow@0 {}]->("player101")-[:serve@0 {}]->("team204")> |
+------------------------------------------------------------------------------+
...
Expand All @@ -88,13 +86,9 @@ nebula> FIND NOLOOP PATH FROM "player100" TO "team204" OVER *;
| path |
+--------------------------------------------------------------------------------------------------------+
| <("player100")-[:serve@0 {}]->("team204")> |
+--------------------------------------------------------------------------------------------------------+
| <("player100")-[:follow@0 {}]->("player125")-[:serve@0 {}]->("team204")> |
+--------------------------------------------------------------------------------------------------------+
| <("player100")-[:follow@0 {}]->("player101")-[:serve@0 {}]->("team204")> |
+--------------------------------------------------------------------------------------------------------+
| <("player100")-[:follow@0 {}]->("player101")-[:follow@0 {}]->("player125")-[:serve@0 {}]->("team204")> |
+--------------------------------------------------------------------------------------------------------+
| <("player100")-[:follow@0 {}]->("player101")-[:follow@0 {}]->("player102")-[:serve@0 {}]->("team204")> |
+--------------------------------------------------------------------------------------------------------+
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
| Name |
+--------+
| player |
+--------+
| team |
+--------+
Got 2 rows (time spent 2038/2728 us)
Expand Down Expand Up @@ -111,4 +110,4 @@ Execution Plan

将上述示例的DOT语言转换为Graphviz图,如下所示。

![Graphviz graph of EXPLAIN SHOW TAGS](https://docs-cdn.nebula-graph.com.cn/docs-2.0/3.ngql-guide/16.query-tuning-statements/explain-show-tags.png)
![Graphviz graph of EXPLAIN SHOW TAGS](https://docs-cdn.nebula-graph.com.cn/docs-2.0/3.ngql-guide/16.query-tuning-statements/explain-show-tags.png)
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ nebula> SHOW JOB 96;
| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time |
+----------------+---------------+------------+-------------------------+-------------------------+
| 96 | "FLUSH" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
+----------------+---------------+------------+-------------------------+-------------------------+
| 0 | "storaged2" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
+----------------+---------------+-------------------------+------------+-------------------------+
| 1 | "storaged0" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
+----------------+---------------+------------+-------------------------+-------------------------+
| 2 | "storaged1" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
+----------------+---------------+------------+-------------------------+-------------------------+
```
Expand Down Expand Up @@ -125,11 +122,8 @@ nebula> SHOW JOBS;
| Job Id | Command | Status | Start Time | Stop Time |
+--------+----------------------+------------+-------------------------+-------------------------+
| 97 | "STATS" | "FINISHED" | 2020-11-28T14:48:52.000 | 2020-11-28T14:48:52.000 |
+--------+----------------------+------------+-------------------------+-------------------------+
| 96 | "FLUSH" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
+--------+----------------------+------------+-------------------------+-------------------------+
| 95 | "STATS" | "FINISHED" | 2020-11-28T13:02:11.000 | 2020-11-28T13:02:11.000 |
+--------+----------------------+------------+-------------------------+-------------------------+
| 86 | "REBUILD_EDGE_INDEX" | "FINISHED" | 2020-11-26T13:38:24.000 | 2020-11-26T13:38:24.000 |
+--------+----------------------+------------+-------------------------+-------------------------+
```
Expand Down
2 changes: 0 additions & 2 deletions docs-2.0/3.ngql-guide/3.data-types/6.list.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ nebula> GO FROM "player100" OVER follow WHERE properties(edge).degree NOT IN [x
| id | degree |
+-------------+--------+
| "player101" | 95 |
+-------------+--------+
| "player102" | 90 |
+-------------+--------+

Expand All @@ -197,7 +196,6 @@ nebula> MATCH p = (n:player{name:"Tim Duncan"})-[:follow]->(m) \
| r |
+------------+
| [142, 136] |
+------------+
| [142, 133] |
+------------+
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ Nebula Graph支持三种方式进行复合查询(或子查询):
| Team | Player |
+-----------+-----------------+
| "Spurs" | "Tony Parker" |
+-----------+-----------------+
| "Hornets" | "Tony Parker" |
+-----------+-----------------+
| "Spurs" | "Manu Ginobili" |
+-----------+-----------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \
| Team | Player |
+-----------+-----------------+
| "Spurs" | "Tony Parker" |
+-----------+-----------------+
| "Hornets" | "Tony Parker" |
+-----------+-----------------+
| "Spurs" | "Manu Ginobili" |
+-----------+-----------------+
```
Loading