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

explorer add template #2144

Merged
merged 3 commits into from
Oct 12, 2022
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
43 changes: 43 additions & 0 deletions docs-2.0/nebula-explorer/db-management/ngql-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 查询语句模板

NebulaGraph Explorer 支持将常用 nGQL 语句保存为模板,方便自己或他人使用。nGQL 语句中的文本还支持参数化,可根据需要填写参数值。

## 前提条件

NebulaGraph 数据库里已经创建 Schema。

## 入口

在顶部导航栏里,点击 ![Template](https://docs-cdn.nebula-graph.com.cn/figures/icon-navbar-queryTemplate.png) 图标。

## 新建模板

1. 单击 **+ 新模板**,设置如下参数。

![new template](https://docs-cdn.nebula-graph.com.cn/figures/ex-template-220916-cn.png)

|参数|示例|说明|
|:---|:---|:---|
|模板名称|`test`|模板的名称。|
|图空间|`basketballplayer`|模板适用的图空间。|
|描述|`返回指定球员的邻居名称`|描述模板的作用。|
|查询模板|`MATCH (v:player{name:"${name}"})--(v2:player) RETURN v2.player.name AS Name;`|nGQL 语句模板。可以选中需要参数化的文本,在右侧单击 **+ 文本参数化**,设置参数名称和描述。示例中`${name}`为参数化的文本,实际使用时可以填写`Tim Duncan`等名称。|
|输入|-|显示参数化的文本内容。可以编辑或删除参数化的文本。|

!!! note

控制台页面左上角单击 **+ 保存为模板**,会自动将已输入的查询语句作为模板语句。

2. 单击**保存为模板**。

## 其他操作

- 目标模板右侧单击 ![setup](https://docs-cdn.nebula-graph.com.cn/figures/setup-220916.png)可以修改模板内容。
- 目标模板右侧单击![console](https://docs-cdn.nebula-graph.com.cn/figures/nav-console2.png) 可以自动跳转至控制台并输入模板。
- 目标模板右侧单击 ![delete](https://docs-cdn.nebula-graph.com.cn/figures/alert-delete.png) 可以删除模板。
- 右上角筛选框可以筛选指定图空间的模板。
- 右上角搜索框可以搜索模板名称。

## 使用模板

除了在模板列表页面单击 ![console](https://docs-cdn.nebula-graph.com.cn/figures/nav-console2.png) 自动跳转至控制台并输入模板,还支持在图探索页面使用模板。详情参见[开始探索](../graph-explorer/ex-ug-query-exploration.md)。
1 change: 1 addition & 0 deletions docs-2.0/nebula-explorer/ex-ug-page-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ NebulaGraph Explorer 由顶部导航栏、左侧导航栏、和画布三大模
| ![create_schema](https://docs-cdn.nebula-graph.com.cn/figures/studio-nav-schema.png) | 对 NebulaGraph 图空间进行管理。详情参见[创建 Schema](db-management/10.create-schema.md)。 |
| ![import_data](https://docs-cdn.nebula-graph.com.cn/figures/studio-btn-download.png) | 将数据批量导入 NebulaGraph。详情参见[导入数据](db-management/11.import-data.md)。 |
| ![Console](https://docs-cdn.nebula-graph.com.cn/figures/nav-console2.png) | 对 NebulaGraph 内的数据使用 nGQL 进行查询操作。详情参见[控制台](db-management/explorer-console.md)。 |
| ![Template](https://docs-cdn.nebula-graph.com.cn/figures/icon-navbar-queryTemplate.png)| nGQL 语句的模板列表。详情参见[查询语句模板](db-management/ngql-template.md)。|
| ![language](https://docs-cdn.nebula-graph.com.cn/figures/navbar-language.png) | 选择 NebulaGraph Explorer 页面的语言,支持中文和英文。 |
| ![help](https://docs-cdn.nebula-graph.com.cn/figures/navbar-help.png) | 帮助页面,指导和帮忙用户使用 NebulaGraph。 |
| ![clear_connection](https://docs-cdn.nebula-graph.com.cn/figures/image-icon10.png) | 显示内核版本并可以断开与 NebulaGraph Explorer 的连接。 |
Expand Down
10 changes: 10 additions & 0 deletions docs-2.0/nebula-explorer/graph-explorer/ex-ug-query-exploration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- VID 查询
- Tag 查询
- 子图查询
- 模板查询

### VID 查询

Expand Down Expand Up @@ -55,3 +56,12 @@
下图为 VID 值为 `Kings`和`Suns`,步数为`2` ,边类型为`server`和`like`的入边的示例。

![tag](https://docs-cdn.nebula-graph.com.cn/figures/query_subgraph_cn.png)

### 模板查询

用户可以选择已创建的查询语句模板,并填写模板参数值。

- 返回结果为点时,画布上会展示这些点。
- 返回结果不为点时,会用表格形式展示结果。例如返回球员姓名、年龄等。

关于查询语句模板详情,请参见[查询语句模板](../db-management/ngql-template.md)。
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ nav:
- Schema 管理: nebula-explorer/db-management/10.create-schema.md
- 数据导入: nebula-explorer/db-management/11.import-data.md
- 控制台: nebula-explorer/db-management/explorer-console.md
- 查询语句模板: nebula-explorer/db-management/ngql-template.md
- 图探索:
- 选择图空间: nebula-explorer/graph-explorer/13.choose-graphspace.md
- 开始探索: nebula-explorer/graph-explorer/ex-ug-query-exploration.md
Expand Down