Skip to content

Commit

Permalink
explorer add template (#1637)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper-lzy authored Sep 28, 2022
1 parent 7208535 commit 7be1ee2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
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 @@
# nGQL template

NebulaGraph Explorer supports saving the commonly nGQL statement as a template for yourself or others. The text in the nGQL statement supports parameterization, and parameter values can be filled in as needed.

## Prerequisites

The schema has been created in the NebulaGraph database.

## Entry

At the top navigation bar, click ![Template](https://docs-cdn.nebula-graph.com.cn/figures/icon-navbar-queryTemplate.png) .

## Create new template

1. Click **+ New Template**, and set the parameters as follows.

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

|Parameter|Example|Description|
|:---|:---|:---|
|Template name|`test`|The name of the template.|
|Space|`basketballplayer`|The graph space to which the template applies.|
|Description|`Returns the neighbor name of the specified player`| Describes the function of the template.|
|Query template|`MATCH (v:player{name:"${name}"})--(v2:player) RETURN v2.player.name AS Name;`|nGQL template. You can select the text you want to parameterize, click **+ parameterize selected content** on the right, and set the parameter name and description. In the example, `${name}` is parameterized text. In actual use, you can fill in a name such as `Tim Duncan`.|
|Input|-|Displays parameterized text content. You can edit or delete it.|

!!! note

Click **+ Save as template** on the upper left corner of the console page to use the entered query statement as a template statement automatically.

2. Click **Save as template**.

## Other Operations

- Click ![setup](https://docs-cdn.nebula-graph.com.cn/figures/setup-220916.png) on the right of the target template to modify the template context.
- Click ![console](https://docs-cdn.nebula-graph.com.cn/figures/nav-console2.png) on the right of the target template to automatically jump to the console and enter the template.
- Click ![delete](https://docs-cdn.nebula-graph.com.cn/figures/alert-delete.png) on the right of the target template to delete the template.
- The filter box in the upper right corner allows you to filter templates for a specified graph space.
- The search box in the upper right corner allows you to search the template name.

## Use template

In addition to clicking ![console](https://docs-cdn.nebula-graph.com.cn/figures/nav-console2.png) on the template list page to automatically jump to the console and enter the template, templates can also be used on the graph exploration page. For details, see [Start querying](../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 @@ The NebulaGraph Explorer page consists of three modules top navigation bar, left
| ![create_schema](https://docs-cdn.nebula-graph.com.cn/figures/studio-nav-schema.png) | Manage NebulaGraph database graph spaces. For more information, see [Create a schema](db-management/10.create-schema.md). |
| ![import_data](https://docs-cdn.nebula-graph.com.cn/figures/studio-btn-download.png) | Bulk import of data into NebulaGraph. For more information, see [Import data](db-management/11.import-data.md). |
| ![Console](https://docs-cdn.nebula-graph.com.cn/figures/nav-console2.png) | Query the NebulaGraph data with nGQL statements. For more information, see [Console](db-management/explorer-console.md). |
| ![Template](https://docs-cdn.nebula-graph.com.cn/figures/icon-navbar-queryTemplate.png)| The template of the nGQL. For details, see [nGQL template](db-management/ngql-template.md).|
| ![language](https://docs-cdn.nebula-graph.com.cn/figures/navbar-language.png) | Select the language of NebulaGraph Explorer page. Chinese and English are supported. |
| ![help](https://docs-cdn.nebula-graph.com.cn/figures/navbar-help.png) | Guide and help you in using NebulaGraph. |
| ![clear_connection](https://docs-cdn.nebula-graph.com.cn/figures/image-icon10.png) | Show the NebulaGraph version and allow you to disconnect from NebulaGraph Explorer. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Click the **Start** ![query](https://docs-cdn.nebula-graph.com.cn/figures/nav-qu
- Query by VID
- Query by Tag
- Query Subgraph
- Query by template

### Query by VID

Expand Down Expand Up @@ -54,4 +55,13 @@ When querying subgraphs, you can specify the number of steps, edge types, and th

The following is an example of VIDs `Kings` and `Suns`, step number `2`, and incoming edge types with a VID value of 101, the number of steps of 4, and edge types of `server` and `like`.

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

### Query by template

You can select the created nGQL template, and set the parameter value.

- When the returned result is vertices, they will be displayed on the canvas.
- When the returned result is not vertices, they will be displayed in table format. For example, return player name, age, etc.

For more information, see [nGQL template](../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 @@ -601,6 +601,7 @@ nav:
- Schema management: nebula-explorer/db-management/10.create-schema.md
- Data import: nebula-explorer/db-management/11.import-data.md
- Console: nebula-explorer/db-management/explorer-console.md
- nGQL template: nebula-explorer/db-management/ngql-template.md
- Graph explorer:
- Choose graph space: nebula-explorer/graph-explorer/13.choose-graphspace.md
- Start querying: nebula-explorer/graph-explorer/ex-ug-query-exploration.md
Expand Down

0 comments on commit 7be1ee2

Please sign in to comment.