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

visual query config updates #1228

Merged
merged 2 commits into from
Apr 20, 2022
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
85 changes: 69 additions & 16 deletions docs-2.0/nebula-explorer/12.query-visually.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@

The Visual Query feature uses a visual representation to express related requests. It allows you to create query scenarios to look up the desired data and view the corresponding statements. You can construct visual query statements by simply dragging and dropping, and then the system displays the query results on the query panel.

!!! compatibility

The Visual Query feature is not compatible with Nebula Graph versions below 3.0.0.


!!! note

Currently, the Visual Query feature is still in beta.

## Prerequisite

- You have choosen a graph space. For details, see [Choose graph spaces](13.choose-graphspace.md).
- You have created indexes for particular queries. For details, see [Note](../3.ngql-guide/7.general-query-statements/2.match.md) and [CREATE INDEX](../3.ngql-guide/14.native-index-statements/1.create-native-index.md).

!!! compatibility

The Visual Query feature is not compatible with Nebula Graph versions below 3.0.0.

## Steps

At the top of the Explorer page, click **Visual Query** to enter the visual query page.

## Page elements

![visual_overview](https://docs-cdn.nebula-graph.com.cn/figures/visual-overview_en.png)
![visual_overview](https://docs-cdn.nebula-graph.com.cn/figures/visual-query-beta_2022-04-15_15-40-07_en.png)

On the left side of the **Visual Query** page, all the Tag(s) corresponding to the graph space (e.g.player and team) and the Tag named **Any Tag** are displayed. You can query vertices without tags by the Tag named **Any Tag**.

Expand All @@ -33,6 +39,53 @@ On the page, the descriptions of other icons are as follows.
| nGQL | Click **nGQL** to view the statement corresponding to the query pattern. |
| Run Query | Click **Run Query** to display the query results visually on the canvas. |

## Configurations

### Vertex configurations

![vertex_confi](https://docs-cdn.nebula-graph.com.cn/figures/vertex-config_en.png)

- **Tag Name**: Set zero, one, or multiple tags.

!!! note

One vertex can have zero or multiple tags:

- When 0 tag is set, query the vertex without tags.
- When 1 tag is set, query the vertex with that tag.
- When multiple tags are set, query the vertex that has all the tags you set.

- **Filter**: Add one or more sets of filter conditions, including vertex properties, operators, and property values.

!!! enterpriseonly

When setting multiple tags in the **Tag Name** dialog box, only the Nebula Graph Enterprise Edition supports setting **filter conditions** to query data.

### Edge configurations

![vertex_confi](https://docs-cdn.nebula-graph.com.cn/figures/edge-config_en.png)

- **Edge Type**: Set one or multiple edge types.

!!! note

One edge have one and only one edge type:

- When one edge type is set, query the edge with that edge type.

- When multiple edge types are set, query the edge that has any of the edge types you set.

- **Direction**: Set the edge direction between two vertices, including Outgoing, Incoming, and Bidirect.

- **Single**: Set a fixed-length path.

- **Range**: Set a variable-length.

- **Filter**: Add one or more sets of filter conditions, including edge properties, operators, and property values.

!!! enterpriseonly

When setting multiple edge types in the **Edge Type** dialog box, only the Nebula Graph Enterprise Edition supports setting **filter conditions** to query data.

## Examples

Expand All @@ -46,12 +99,12 @@ Find out players who follow each other with Yao Ming and older than 35, and whic

2. Configure filter conditions.

1. Set the filter condition for the first player to `player.name == Yao Ming`.
2. Set the edge type of the edge between the first and second players to `follow`, set the direction to `Bidirect`, and the steps to `1`.
3. Set the filter condition for the second player to `player.age > 35`.
4. Set the edge type of the edge between the second player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
5. Click ![Output](https://docs-cdn.nebula-graph.com.cn/figures/visual-nav-output.png) to select the second player, the team, and the serve edge between them.
6. Click the **Query Pattern** frame, and set the **Limit Number** to `6`.
1. Set the filter condition for the first player to `player.name == Yao Ming`.
2. Set the edge type of the edge between the first and second players to `follow`, set the direction to `Bidirect`, and the steps to `1`.
3. Set the filter condition for the second player to `player.age > 35`.
4. Set the edge type of the edge between the second player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
5. Click ![Output](https://docs-cdn.nebula-graph.com.cn/figures/visual-nav-output.png) to select the second player, the team, and the serve edge between them.
6. Click the **Query Pattern** frame, and set the **Limit Number** to `6`.

3. Click **Run Query**, and the system displays 6 query patterns on the canvas.

Expand All @@ -65,11 +118,11 @@ Find out what teams two mutually-following players are loyal to and query for al
1. Create a query pattern by dragging and dropping Tags to the panel (3 players and 1 team).
2. Configure filter conditions.

1. Set the edge type of the edge between the first and second players to `follow`, set the direction to `Bidirect`, and the steps to `1`.
2. Set the edge type of the edge between the first player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
3. Set the edge type of the edge between the second player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
4. Set the filter conditions for the third player to `player.age > 30`.
5. Set the edge type of the edge between the third player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
6. Click ![Output](https://docs-cdn.nebula-graph.com.cn/figures/visual-nav-output.png) to select the third player, the team, and the serve edge between them.
1. Set the edge type of the edge between the first and second players to `follow`, set the direction to `Bidirect`, and the steps to `1`.
2. Set the edge type of the edge between the first player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
3. Set the edge type of the edge between the second player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
4. Set the filter conditions for the third player to `player.age > 30`.
5. Set the edge type of the edge between the third player and the team to `serve`, the direction to `Outgoing`, and the steps to `1`.
6. Click ![Output](https://docs-cdn.nebula-graph.com.cn/figures/visual-nav-output.png) to select the third player, the team, and the serve edge between them.

3. Click **Run Query**.