SPARQL queries¶
What’s in this document?
To manage and query your data, go to the SPARQL menu tab. The SPARQL view integrates the YASGUI query editor plus some additional features that are described below.
Tip
SPARQL is a SQL-like query language for RDF graph databases with the following request types:
SELECT— returns tabular resultsCONSTRUCT— creates a new RDF graph based on query resultsASK— 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 sourceINSERT— inserts triples into a graphDELETE— deletes triples from a graph
The SPARQL editor offers two display modes — horizontal and vertical.
Use the vertical mode switch in the upper right 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 the left of the vertical/horizontal mode switch in the upper right) to control which of these is displayed.
Manage your data by writing queries in the text area. It offers syntax highlighting and namespace autocompletion for easy reading and writing.
Tip
To manage the built-in list of declared namespaces, go to .
Include or exclude inferred statements in the results by clicking the >> icon. When inferred statements are included, both elements of the arrow icon are a solid line (ON), otherwise the left element is a solid line and the right one is a dotted line. (OFF).
Enable or disable the expanding of the results over owl:sameAs by clicking the last icon above the Run button. Similarly to the one above it, the setting is ON when all its three circles are a solid line, and OFF when two of them are a dotted one.
Execute the query by clicking the Run button or use Ctrl/Cmd + Enter.
Tip
You can find other useful shortcuts in the keyboard shortcuts link in the lower right corner of the SPARQL editor.
The results can be viewed in different formats corresponding 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 sort the results by column values and filter them by table values. The query results header will display the total number of results and the time it took to execute the query.
Note
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.
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 values 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.
The query results are limited to 1,000, 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. Choices include JSON, XML, CSV, TSV and Binary RDF for SELECT queries and all supported RDF formats for CONSTRUCT and DESCRIBE query results.
Interrupt queries¶
You can use the Abort query button in the SPARQL editor to manually interrupt any query.

