Write Queries

Write Queries

On the Write Queries page, you can design and run custom queries with TigerGraph's powerful graph query language – GSQL.

The Write Query page is horizontally divided into two parts:

  1. Query Editing Panel

  2. Result, Log and Visualization Panel

Query Editing Panel

The Query Editing panel is divided into two subpanels: the left subpanel is used to select a query to edit, and the right, larger subpanel displays the selected query for editing. Here you can edit, save, delete, install and run the query. The query editor features syntax highlighting customized for the GSQL language. Also, the query editor performs real-time semantic checking.

Above the query editing pane is a toolbar, with the following buttons, from left to right:

  • Expand/Collapse : Expand or collapse the Query Editing panel to or from full page mode. The icon changes depending on whether the panel is currently expanded or collapsed.

  • Save : Save the current query draft.

  • Install : Install the query into the database.

  • Run : Run the installed query.

  • Delete : Delete the selected query.

  • Show query endpoint: Show the RESTFul endpoint to execute the query. Only installed queries can see their RESTFul endpoints.

Add Or Edit Query

A query draft will be created with a template:

To edit an existing query, click on the query name in the list in the left sub panel:

Save Query Draft

Install Query

Run Query

A query has to be installed before you can run it.

The query will be executed, and the results will be shown in the Result Panel.

Delete Query

Show Query Endpoint

Install All Queries

Click INSTALL button, then the listed queries will be installed:

Result Panel

The Result panel shows the result of the last run query. Each query generates up to three types of result: visualized graph, JSON text, or log messages. On the left is a toolbar with buttons for changing the the panel size or for switching to a different type of result. The buttons, from top to bottom, are the following:

View Schema:

Viewing graph schema makes it more convenient for developers to refer to the schema topology logic and easier to write correct GSQL queries.

Visual Result

If the query execution result contains a graph structure, the result will be visualized in this panel as a graph. The panel is the same as the Explore Graph panel. Please refer to the documentation for the Explore Graph panel. The only difference is that each time you run a query, the previous result will be erased. In Explore Graph the results are added incrementally.

You can switch to the JSON Result panel to see the result in JSON format.

JSON Result

If there is no graph structure in the result, the result will be displayed in this panel as a JSON object.

You can learn about the JSON format in the GSQL Language documentation , and integrate it with your applications. In this fashion, the TigerGraph system can serve as a backend or embedded graph data service.

Query Log

If a query ran successfully, the Query Log message will be "query ran successfully" or something similar. If there was anything wrong when executing your query, such as invalid parameters or runtime errors, an error message will be shown in the Query Log panel:

Expand Panels

If you expand the Query Editing panel, it looks like this:

If you expand the Result panel, it looks like this:

Last updated