Lab: Ontop: Difference between revisions
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
'''Task:''' Create a folder on your local computer for this exercise. Go to the new folder and open a Console or Terminal window. Start SQLite3 with the name of a new database, for example 'MyTestDB.sqlite'. | '''Task:''' Create a folder on your local computer for this exercise. Go to the new folder and open a Console or Terminal window. Start SQLite3 with the name of a new database, for example 'MyTestDB.sqlite'. | ||
'''Task:''' Based on the example files | '''Task:''' Based on the example files ''Fig6.3-xxxxxx.sql'' in [https://mitt.uib.no/courses/51914/files/folder/Examples the Examples folder in mitt.uib.no], create the following two tables and fill them with test data: | ||
Line 28: | Line 28: | ||
'''Task:''' Draw an example graph on paper that represents the XXX and XXX rows of the two tables. | '''Task:''' Draw an example graph on paper that represents the XXX and XXX rows of the two tables. | ||
'''Task:''' Based on the example files | '''Task:''' Based on the example files ''Fig6.4-xxxxxx.obda'' and/or ''Fig6.4-xxxxxx.r2rml'' in [https://mitt.uib.no/courses/51914/files/folder/Examples the Examples folder], create a mapping from the two tables into an RDF graph. | ||
===GraphDB Ontop configuration=== | ===GraphDB Ontop configuration=== | ||
'''Task:''' You already have Ontop as part of your GraphDB installation, but you need an additional ''.jar''-file - a JDBC driver - for connecting to your database of choice. For SQLite3, you can download the driver from [https://github.com/xerial/sqlite-jdbc Xenial on GitHub]. Place the ''.jar''-file in the ''lib/''-subfolder of your GraphDB installation folder. Restart Ontop. | '''Task:''' You already have Ontop as part of your GraphDB installation, but you need an additional ''.jar''-file - a JDBC driver - for connecting to your database of choice. For SQLite3, you can download the driver from [https://github.com/xerial/sqlite-jdbc Xenial on GitHub]. Place the ''.jar''-file in the ''lib/''-subfolder of your GraphDB installation folder. Restart Ontop. | ||
'''Task:''' Create a new Ontop repository. The ''Driver class'' should be ''org.sqlite.JDBC''. The ''JDBC URL'' should be ''jdbc:sqlite:PATH'', where PATH is the location of your SQLite3 database, for example ''jdbc:sqlite:C:/Users/MyUser/OntopLab/MyTestDB.sqlite''. | '''Task:''' | ||
* Create a new Ontop repository. | |||
* The ''Driver class'' should be ''org.sqlite.JDBC''. The ''JDBC URL'' should be ''jdbc:sqlite:PATH'', where PATH is the location of your SQLite3 database, for example ''jdbc:sqlite:C:/Users/MyUser/OntopLab/MyTestDB.sqlite''. | |||
* Load the OBDA or R2RML mapping file. | |||
* Click ''Create'' and activate the new repository. | |||
===Running SPARQL queries (and updates?)=== | ===Running SPARQL queries (and updates?)=== | ||
Line 42: | Line 46: | ||
* XXX | * XXX | ||
==If you have more time== | |||
===Running federated SPARQL queries=== | ===Running federated SPARQL queries=== | ||
'''Task:''' Create another SQLite3 database, for example ''AnotherTestDB.sqlite'', for the following table: | '''Task:''' Create another SQLite3 database, for example ''AnotherTestDB.sqlite'', for the following table: | ||
Line 54: | Line 60: | ||
* XXX | * XXX | ||
''Tip:'' in Ontop, under ''Settings -> Repository'', you can XXX to get the | ''Tip:'' in Ontop, under ''Settings -> Repository'', you can XXX to get the | ||
Revision as of 22:03, 10 February 2025
Topics
- Creating SQLite3 databases
- Creating OBDA or R2RML mappings
- Setting up Ontop in GraphDB
- Querying SQLite3 databases through a virtual Ontop KG
Useful materials
- SQLite3 installation and quick start
- GraphDB Ontop introduction and installation
- OBDA and R2RML mapping examples
- Federated SPARQL queries
Tasks
We recommend you run this exercise through the Ontop plugin to the free desktop version of OntoText's GraphDB tool. You can also use one of the open-source versions of Ontop.
Installing and running SQLite3
Task: Download and install a relational database system on your computer. We recommend the very light-weight and easy-to-install SQLite3.
Task: Create a folder on your local computer for this exercise. Go to the new folder and open a Console or Terminal window. Start SQLite3 with the name of a new database, for example 'MyTestDB.sqlite'.
Task: Based on the example files Fig6.3-xxxxxx.sql in the Examples folder in mitt.uib.no, create the following two tables and fill them with test data:
You can either enter SQL statements interactively one by one, or you can save them to a file and use SQLite3's .read command. Use the .exit command when you are done.
OBDA and R2RML mappings
Task: Draw an example graph on paper that represents the XXX and XXX rows of the two tables.
Task: Based on the example files Fig6.4-xxxxxx.obda and/or Fig6.4-xxxxxx.r2rml in the Examples folder, create a mapping from the two tables into an RDF graph.
GraphDB Ontop configuration
Task: You already have Ontop as part of your GraphDB installation, but you need an additional .jar-file - a JDBC driver - for connecting to your database of choice. For SQLite3, you can download the driver from Xenial on GitHub. Place the .jar-file in the lib/-subfolder of your GraphDB installation folder. Restart Ontop.
Task:
- Create a new Ontop repository.
- The Driver class should be org.sqlite.JDBC. The JDBC URL should be jdbc:sqlite:PATH, where PATH is the location of your SQLite3 database, for example jdbc:sqlite:C:/Users/MyUser/OntopLab/MyTestDB.sqlite.
- Load the OBDA or R2RML mapping file.
- Click Create and activate the new repository.
Running SPARQL queries (and updates?)
Task: Write SPARQL queries that answer the following questions:
- XXX
Task: Write the following SPARQL updates:
- XXX
If you have more time
Running federated SPARQL queries
Task: Create another SQLite3 database, for example AnotherTestDB.sqlite, for the following table:
Task: Create an OBDA and R2RML mapping for the new database.
Task: Create a GraphDB Ontop repository using the new mapping.
Task: Write a federated SPARQL query that answers the following question:
- XXX
Tip: in Ontop, under Settings -> Repository, you can XXX to get the