Ontology and Database Systems Labs 2014/2015

Lab 7. Learning to use the Ontop API.

  1. Start the h2 database distributed in lab-6.

    After login, set a password for h2.

          ALTER USER SA SET PASSWORD 'rioyxlgt'
  2. Install Eclipse (Luna).

  3. Create a new Maven Project via File -> New -> Other -> Maven -> Maven Project, for instance

  4. Open the example_files. Replace the created default pom.xml file with the downloaded file. Copy exampleBooks.obda and exampleBooks.owl to src/main/resources/example. Copy QuestOWLExample.java to src/main/java, and fix the compilation error as Eclipse suggests: move QuestOWLExample.java to package org.semanticweb.ontop.examples. The structure of you project should be as follows:

  5. You can now run QuestOWLExample.java as a Java application. You will get the answers to sparqlQuery defined in the code. Also, you will get the SQL unfolding of that SPARQL query.
This simple example shows you how to use the ontop API. If you are going to develop a Java application for your project, you should probably start from this example.

Useful Links

  1. Ontop wiki
  2. Mapping Design Tips
  3. Using ontop as Maven dependency
  4. Using R2RML with ontop
  5. Ontop: Answering SPARQL Queries over Relational Databases (Paper currently under review)