# Ontop with Denodo

NB: You might also consult the following presentation, which shows screenshots for some of the steps described below:
https://github.com/ontop/ontop-examples/blob/master/cikm-2018-tutorial/4-obdi-demo.pdf (opens new window)

# 1. Set up Denodo.

# Download Denodo Express

Download it from https://www.denodo.com/en/denodo-platform/denodo-express (opens new window)
(register, download the platform and the licence file)

Unzip the file and run the installer.

Note: environment variable JAVA_HOME must be set

# Running Denodo

<DenodoInstallationPath>/bin/denodoPlatform.sh
  • Select the 'Virtual DataPort' tab
  • Start 'Virtual DataPort Server'
  • Press the 'Launch' button
  • Login with:
    . Login: admin
    . Password: admin
    . Server: //localhost:9999/admin

# 2. Configure datasets with Denodo

NB: instead of doing the following step by step, you can also load this SQL script directly within Denodo.

# Create a database

We will create two data sources based on web APIs.
First, a Web API with weather data.

  • Administration -> Database Management -> New
  • Name the database bzopendata for instance (leave the rest to default values), and click on the 'OK' button
  • In the left window, right-clik on the bzopendata database -> New -> Data Source -> JSON
  • In the field 'Name', enter stations
  • In the field 'Data route', select 'HTTP Client'
  • Click on the 'Configure' button to enter the URL of the source:
    http://daten.buergernetz.bz.it/services/meteo/v1/stations (opens new window)
  • Click on 'OK', and then press the 'Save' button to save the data source

Then add a second data source for sensor data, repeating all the operations above, but:

# 3. Configure the datasources

Select a data source, and click on 'Create base view'

  • for stations: use the default "tuple root" (/JSONFile)
  • for sensors: use the "tuple root": /JSONFile/JSONArray (uncheck the checkbox 'JSON root')

Click on 'Save'.

For stations, click on the 'Execution panel' button, and then the button 'Execute'

We get only one result --> We need to flatten the data:

  • In the left window, right-click on {}stations -> New -> Flatten (to display the data sources, you may need to right-click on 'bzopendata' -> 'Refresh')
  • Right click on the row 'features' in the table -> 'Flatten array features'

In addition, we want to project the subfields of the JSON object 'properties':

  • Select the 'Output' tab
  • Right-click on the row 'properties' in the table -> 'Project subfields of properties'

Click on 'Save': this creates a new view 'f_stations'

# 4. Configure Ontop-protege to use a Denodo datasource

  • Install the Denodo JDBC driver: Within Protege: File -> Preferences -> 'JDBC Drivers' tab -> Add
    . Description: Denodo
    . Class name: com.denodo.vdp.jdbc.Driver
    . Driver File (jar): browse to <DenodoInstallationPath>/tools/client-drivers/jdbc/denodo-vdp-jdbcdriver.jar

  • For the connection, in your Datasource manager, use:
    . Connection url: jdbc:vdb://localhost:9999/bzopendata
    . Database Username: admin
    . Database Password: admin
    . Driver class: com.denodo.vdp.jdbc.Driver

# 5. Create the ontology and mapping and and try some SPARQL queries

You can use directly the files we have prepared:

# 6. Setup a SPARQL endpoint with Command Line Interface

# Configure Ontop CLI

Add the JDBC denodo driver for the Ontop CLI:

cp <DenodoInstallationPath>/tools/client-drivers/jdbc/denodo-vdp-jdbcdriver.jar
<OntopInstallationPath>/jdbc

Run the Ontop CLI:

ontop endpoint -t bzweather.owl -m bzweather.obda -p bzweather.properties --cors-allowed-origins='*'

# Access the SPARQL endpoint

Open http://localhost:8080/ (opens new window)

Run an example SPARQL query:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
PREFIX : <http://example.org/weather#>
SELECT *
{
  ?station a :WeatherStation ; geo:asWKT ?wkt; :hasSensor ?sensor ; :longitude ?lon; :latitude ?lat .
  ?sensor sosa:madeObservation ?o .
  ?o sosa:hasSimpleResult ?wktLabel .
  ?o sosa:resultTime ?t .
}
LIMIT 100