Skip to main content

Writing SPARQL Queries against your semantic model

After you export a mapping file to data.world, you can write SPARQL queries against the data source that is accessible through the mapping file.

A video tutorial is available: Writing SPARQL Queries against your semantic model

NOTE: You can open the mapping file in a tool such as dw Editor.

sparql_1.png

SPAQRL is a query language for interacting with RDF and Turtle files. It is not yet possible to use conventional SQL against RDF and Turtle files.

Let's walkthough the creation of a simple SPARQL query.

1. Access your dataset in data.world, then click Explore this dataset, and then click the +Add button in the upper-left corner. Choose SPARQL Query from the drop-down menu.

sparql_2.png

2. A PREFIX statement will appear at the top of the new query, which is the namespace for the data.world dataset. Add another namespace for the the Grafo model by copying all but the last part of the IRI.

sparql_3.png

3. Paste the IRI path into the model namespace in the SPARQL query. Begin structuring the query with select *...where. Also, enter a service: mapped statement to indicate that you want the query to employ the data.world mapping service.

sparql_4.png

4. Write a query, for example, to retrieve the full name of the student. The syntax is ?x model:full_name ?StudentFullName. Click the Run query button in the upper-right corner to verify that the query works as you intend.

sparql_5.png