Skip to content

Visual Query

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 NebulaGraph versions below 3.0.0.

Note

Currently, the Visual Query feature is still in beta.

Prerequisite

Page elements

visual_overview

At the top of the Explorer page, click Visual Query to enter the visual query page. 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.

Note

Any Tag can also be used to query the vertex without a tag.

On the page, the descriptions of other icons are as follows.

Icon/Element Description
Output The selected vertices and edges are the results to be queried. Double-click on the query pattern frame to limit the number of queries (with a priority higher than the value of the maximum number of returns in the global settings). Only querying edges is not supported.
Zoomin Zoom in on the query page.
Zoomout Zoom out on the query page.
Save Save the current query graph. The saved graph is cached in the browser.
Visual_history View all stored query graphs. Up to 10 recently saved visual graphs are displayed. Click any of the stored graphs to display them on the visual query page.
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.

Steps

  1. Drag several target tags from the left side of the Visual Query page to the canvas to create the corresponding vertices.

  2. Click a vertex, hold down the left mouse button on the anchor point at the edge of the vertex, and drag it to another vertex to create the corresponding edge.

  3. Set a vertex by clicking it. The descriptions of configuration options are as follows.

    vertex_confi

    • 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.

    Note

    When setting multiple tags in the Tag Name dialog box, it is not supported to set filter conditions to query data.

  4. Set an edge by clicking. The descriptions configuration options are as follows.

    vertex_confi

    • 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.

    Note

    When setting multiple edge types in the Edge Type dialog box, it is not supported to set filter conditions to query data.

  5. After the query scenarios (pattern) is created, click Output and select the result you want to return.

  6. Click Run Query on the upper right corner of the Visual Query page to display the query results on the canvas.

Examples

Example 1

Find out players who follow each other with Yao Ming and older than 35, and which teams these players are loyal to, and limit the number of the query patterns of the players and teams to 6.

query_visually_example_1

  1. Create a query pattern by dragging and dropping Tags to the panel (2 players and 1 team).

  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 vertices of the tag player 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 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.

Example 2

Find out what teams two mutually-following players are loyal to and query for all players on that team who are older than 30.

query_visually_example_2

  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 to select the third player, the team, and the serve edge between them.
  3. Click Run Query.


Last update: February 1, 2023