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

fetch format #1060

Merged
merged 4 commits into from
Oct 15, 2021
Merged
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
13 changes: 8 additions & 5 deletions docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# FETCH

<!-- 3.0强制使用YIELD后需要修改本文档,参考 https://confluence.nebula-graph.io/pages/viewpage.action?pageId=10723963 -->

`FETCH`可以获取指定点或边的属性值。

## openCypher兼容性
Expand All @@ -13,15 +15,16 @@
```ngql
FETCH PROP ON {<tag_name>[, tag_name ...] | *}
<vid> [, vid ...]
[YIELD <output>]
[YIELD <return_list> [AS <alias>]];
```

|参数|说明|
|:---|:---|
|`tag_name`|Tag名称。|
|`*`|表示当前图空间中的所有Tag。|
|`vid`|点ID。|
|`output`|指定要返回的信息。详情请参见[`YIELD`](../8.clauses-and-options/yield.md)。如果没有`YIELD`子句,将返回所有匹配的信息。|
|`YIELD`|定义需要返回的输出。除了返回定义的属性,额外返回`VertexID`。详情请参见[`YIELD`](../8.clauses-and-options/yield.md)。如果没有`YIELD`子句,默认返回`vertices_`,包含点的所有信息。|
|`AS`| 设置别名。|

### 基于Tag获取点的属性值

Expand All @@ -42,9 +45,9 @@ nebula> FETCH PROP ON player "player100";

```ngql
nebula> FETCH PROP ON player "player100" \
YIELD player.name;
YIELD player.name AS name;
+-------------+--------------+
| VertexID | player.name |
| VertexID | name |
+-------------+--------------+
| "player100" | "Tim Duncan" |
+-------------+--------------+
Expand Down Expand Up @@ -132,7 +135,7 @@ FETCH PROP ON <edge_type> <src_vid> -> <dst_vid>[@<rank>] [, <src_vid> -> <dst_v
|`src_vid`|起始点ID,表示边的起点。|
|`dst_vid`|目的点ID,表示边的终点。|
|`rank`|边的rank。可选参数,默认值为`0`。起始点、目的点、Edge type和rank可以唯一确定一条边。|
|`output`|指定要返回的信息。详情请参见[`YIELD`](../8.clauses-and-options/yield.md)。如果没有`YIELD`子句,将返回所有匹配的信息。|
|`YIELD`|定义需要返回的输出。除了返回定义的属性,额外返回`起始点ID`、`目的点ID`和`rank`。。详情请参见[`YIELD`](../8.clauses-and-options/yield.md)。如果没有`YIELD`子句,默认返回`edges_`,包含边的所有信息。|

### 获取边的所有属性值

Expand Down