Sparql editor


The Sparql page can be accessed through Sparql button located on the top right corner of a dataset page.

This page is based on a tabbed panel that allows to open up to 11 sparql editor.


SPARQL query editor

This editor is divided into three parts:

Query Editing

The query editing section of the SPARQL Editor contains a text area for typing the query. A syntax completion helper (see figure below, where RDFS predicates are being suggested) is automatically activated at each section of the query where it might provide suggestions. Syntax checking and highlighting are also features of this editor.

The syntax completion helper and syntax checking/highlighting features have been made available by adapting the open source YASGUI SPARQL editor to the VocBench environment. Besides the inclusion in the environment of ShowVoc, the completion has been improved to provide not only language syntax completion, but also (to a limited extent) live suggestions from the data present in the managed dataset (e.g. available prefix/namespace mappings).


Results Area

The results area of the SPARQL Tab shows the results of the submitted query:

Exporting results

The results obtained from a SPARQL query can be exported to an external file.

export formats

Currently the following formats are supported:

Storing and Loading queries

ShowVoc is provided with an internal storage for configurations and settings, in this storage a SPARQL query can be stored and consequently loaded using the two buttons on the right under the SPARQL textarea (available only to authenticated users).

The Store SPARQL query dialog prompts an ID (identifier of the query) and a scope (available: SYSTEM, PROJECT, USER, PROJECT_USER) which tells at which level the confiquration will be stored. Additionally, the dialog shows the previously stored queries so it is possible to override an existing one.

The Load SPARQL query dialog simply lists the available stored queries that can be loaded into the editor. The stored queries can be also deleted from this dialog.

sparql load

In the Load SPARQL query dialog it is also possible to filter the list of previously saved queries by using the search field in the lower part of the dialog. For example, by using the text "xlabels" only the queries having the word "xlabels" in their name are shown:

sparql load filter

Parameterized SPARQL query editor

This editor is for the most the same as the previously described one; in addition it allows auhtenticated users to configure a set of variable bindings to be applied to the SPARQL query. It is possible to parameterize only stored queries, so in order to create a parameterized query, it is first necessary to create and store a "standard" query, then it can be parameterized by loading it into the Stored query textarea (through the "pencil" button). Each variable defined in the query can then be constrained to some classes of values, or grounded to a specific value. The result is a user-friendly form for a query where users can easily provide values for the variables in the query or leave them free in order to see their groundings in the result.

sparql parameterized query editor


The right panel Variable bindings allows to create and edit parameterization for the current loaded query (through the "pencil" button). The Query parameterization dialog requires the following information:

query parameterization

Once the parameterization is defined, it is possible to bind values to the variables. Each input field in the Variable bindings panel guides the user to enter a value that is compliant with the constraints defined by the parameterization. For instance, in the example shown in the above figure, the type field suggests to enter a class, while the name suggests to enter a plain literal or an xsd:string literal.
Submitting the query with the variable bounds is equivalent to evaluate a query with the provided values in place of the variables. So, this represents a reusable and customizable way to evaluate structurally equal queries which may differ only from the values assigned to the variables. A parameterized query can be evaluated also ignoring the bindings simply unchecking the Use variable bindings flag.
The "eye" button on the panel heading switches the name of the input field between the Display name and the Binding variable defined during the parameterization.
Under the Variable bindings panel there is a textarea dedicated to the description of the parameterized query. The description is especially useful when using the parameterized query in the Custom Search.

Parameterized queries and Custom Search

Like the "standard" SPARQL queries, also the parameterized queries can be stored and loaded. Stored SPARQL SELECT queries which return a single variable can be used for the Custom Search, a search feature that exploits the power of the SPARQL language to perform customizable queries. For detailed information see the dedicated section.