Querying Data

To manage and query your data, click the SPARQL menu. The SPARQL view integrates the YASGUI query editor plus some additional features, which are described below.


SPARQL is a SQL-like query language for RDF graph databases with the following types:

  • SELECT - returns tabular results;
  • CONSTRUCT - creates a new RDF graph based on query results;
  • ASK - returns “YES”, if the query has a solution, otherwise “NO”;
  • DESCRIBE - returns RDF data about a resource; useful when you do not know the RDF data structure in the data source;
  • INSERT - inserts triples into a graph;
  • DELETE - deletes triples from a graph.

The SPARQL editor offers two viewing/editing modes - horizontal and vertical.


Use the vertical mode switch to show the editor and the results next to each other, which is particularly useful on wide screen. Click the switch again to return to horizontal mode.


Both in horizontal and vertical mode, you can also hide the editor or the results to focus on query editing or result viewing. Click the buttons Editor only, Editor and results or Results only to switch between the different modes.

  1. Manage your data by writing queries in the text area. It offers syntax highlighting and namespace autocompletion for easy reading and writing.


    To add/remove namespaces, go to Data -> Namespaces.

  2. Include or exclude inferred statements in the results by clicking the >>-like icon. When inferred statements are included, both elements of the arrow icon are the same colour (ON), otherwise the left element is dark and the right one is greyed out (OFF).

  3. Execute the query by clicking the Run button or use Ctrl/Cmd + Enter.


    You can find other useful shortcuts in the keyboard shortcuts link in the lower right corner of the SPARQL editor.

  4. The results can be viewed in different formats according to the type of the query. By default, they are displayed as a table. Other options are Raw response, Pivot table and Google Charts. You can order the results by column values and filter them by table values. The total number of results and the query execution time are displayed in the query results header.


    The total number of results is obtained by an async request with a default-graph-uri parameter and the value http://www.ontotext.com/count.

  5. Navigate through all results by using pagination (SPARQL view can only show a limited number of results at a time). Each page executes the query again with query limit and offset for SELECT queries. For graph queries (CONSTRUCT and DESCRIBE), all results are fetched by the server and only the page of interest is gathered from the results iterator and sent to the client.

  6. The query results are limited to 1000, since your browser cannot handle an infinite number of results. Obtain all results by using Download As and select the required format for the data (JSON, XML, CSV, TSV and Binary RDF for Select queries and all RDF formats for Graph query results).

  7. Use the editor’s tabs to keep several queries opened, while working with GraphDB. The queries are saved in your browser’s local storage, so you can return to them even after switching views.

  8. Save your query with the Create saved query icon.

  9. Access existing saved queries from the Show saved queries icon (saved queries are persisted on the server running the Workbench).

  10. Copy your query as a URL by clicking the Get URL to current query icon. For a longer query, first save it and then get a link to the saved query by opening the saved queries list and clicking the respective Get URL to query icon.