How to Access Open Data Hub Data Using SPARQL

Changed in version 2023.1: notify users of SPARQL endpoint reachable upon request only.

Warning

The SPARQL endpoint is currently not active, but can be activated upon request to . However, the ODH SPARQL portal, which contains sample data and queries, can be accessed at https://sparql.opendatahub.com/.

The Open Data Hub's dataset can be queried using the SPARQL query language, using the Open Data Hub Knowledge Graph Portal. This howto helps you in getting acquainted with the functionalities offered by the endpoint. However, this howto does not cover SPARQL: if you are not familiar with it, here is some reference:

  • The SPARQL Query Language Recommendation is the official and normative W3C definition of SPARQL and also contains a lot of examples and querie to learn from
  • A tutorial about SPARQL written by Apache Jena’s team. Oriented toward Jena, it nonetheless includes and explains a lot of basic notions

Data Available in the Portal

The landing page of Open Data Hub's SPARQL endpoint contains the following elements:

  1. The buttons in the banner at the top of the page.

    Playground

    The Playground is a space in which to freely write SPARQL queries against the Open Data Hub datasets. It is most suited for users that already know SPARQL and how to use it to interact with Open Data Hub.

    Regular Queries

    Regular Queries are a sample queries that can be used either standalone, to gather example data, or can be edited and modified to tweak the results.

    Data Quality Queries

    Similar to Regular Queries, Data Quality Queries are precooked queries that will gather data, but with an emphasis on their quality. They can be used to check whether some of the data are incomplete.

    Mobility

    Mobility queries are sample queries against all the datasets in the entire mobility domain. They can be used as they are or modified and tweaked to extract more precise data.

    Tourism and Mobility

    Tourism and Mobility queries combine datasets from the tourism domain with observations gathered by sensors in the mobility domain.

  2. The main area, consisting of a large textarea, in which to write SQARQL queries, and of a number of precooked queries when the Regular Queries or Data Quality Queries buttons are clicked. The three buttons on the textarea’s top right corner can be used to

    • Copy the URL of the query and share it, store it for future use, or use it in scripts.
    • maximise the textarea
    • execute the query. If the query contains some syntactic error, it is accompanied by a yellow question mark and it is not executed, but an error message is displayed
  3. A number of visualisation and download options in the bottom area. Also this part of the area can be maximised

    • Table. A simple table with a result on each row
    • Response. The actual JSON received as result
    • Pivot Table. Analyse statistically the query result
    • Google chart. Use the data retrieved within a Google Chart. The default representation is a simple table, more can be employed, by clicking on the Chart Config button on the right-hand side.
    • Geo. See on a map the location of the results
    • download the result set as a CSV file

Working in The Playground

The playground is the place in which you can build you queries against the Open Data Hub endpoint. Queries can be built using built-in or custom prefixes as well as all SPARQL operators. There is a validation of the queries, therefore in case of mistakes a red warning icon will appear on the left-hand side of the offending line.

Note

Generic queries might return hundreds or thousands of results, so the use of the LIMIT clause helps to receive quicker answers.

Working with Regular Queries

Regular queries are predefined queries that give a glimpse of the data contained in the Open Data Hub. Regular queries are rather generic and can be used as starting point for more precise and refined queries. They can be edited directly in the textarea or copy and pasted in the Playground.

Working with Data Quality Queries

Data quality queries are built with purpose to verify if there are incomplete or wrong data in a dataset.