Semantic Web Technologies labs

The page for the lectures can be found here.

This page contains the schedule and contents of the lab exercises, part of the course Semantic Web Technologies.

Please send your solutions for the exercises by email to debruijn AT inf.unibz.it. The format for the solutions is mentioned under the heading Output for each exercise.

The exercises may be done in a group. Please indicate so when submitting the solutions for an exercise.

The lab exercises are mandatory. The exercises will be graded, and will make up 34% of the overall mark, if the average grade for the exercises is higher than the grade of the exam.

The final deadline for all lab exercises is May 30, 2007. However, the exercises will help to better understand the lecture material, and the output of each exercise will typically be used in the next exercise. And therefore, it is beneficial to the students to complete exercises as soon as possible

The goal of the lab exercises is to give you hands-on experience in using Semantic Web Technologies. The tools we use in the labs are Protege, an ontology modeling tool, Jena, a Java framework for RDF and OWL, and FLORA-2, an F-Logic reasoner based on XSB.

Schedule

The lab exercises will be on Wednesdays from 17:00-19:00 in computer room E431, on March 28, April 18, May 2, May 9 and May 16, and in seminar room E420 on May 23.

  1. Mar 07 and 14. Your first ontology
  2. Mar 28. Querying your ontology
  3. Apr 18. Extending your ontology to OWL
  4. May 02. Manipulating your ontology with Jena
  5. May 09. F-Logic Modeling and Reasoning with FLORA-2
  6. May 16. Service Discovery with FLORA-2
  7. May 23. Course review and exam preparation

1. Your first ontology (07 and 14 March 2007)

Model an ontology according to the methodology in the paper: Ontology Development 101. The domain to model is the university domain. Model universities, faculties, courses, university employees, professors, students, etc. Follow the steps in the paper for creating the ontology, and pay special attention to the competency questions in the first step of the methodology. Optionally, include also some instance information; include at least the university of Bolzano, yourself, a number of courses and a number of professors you know at the university, and the relations between them.

Use the Protege tool for creating the ontology with RDFS. Save the project as RDF files and have a look inside. You will see an RDFS file which contains the ontology and an RDF file which contains the instance data.

Protégé allows to model several features which are not present in RDFS. As these features will not be exported, when saving the project as RDF files, you should stick to the features offered by RDFS when modeling your ontology (see pages 5 and 6 of the lecture 2 slides)

Output

Make sure to create an "RDF Files" project in Protege. The output consists of all the files generated by Protege.
Make sure to select "plain RDF" when saving the project.

The output of the exercise consists of the RDF and RDFS files included in the project, as well as the list of competency questions you originally formulated in the first step of the methodology.

Reading

2. Querying your ontology (28 March 2007)

Use Jena to query your ontology. Find a simple introduction into using Jena to query SPARQL here.

You can use the ARQ command line utilities to test SPARQL queries. You may have to download the ARQ distribution separately to obtain the command line utilities.

Create a Java application to query your ontology (both RDF and RDFS files). Issue (variants of) the following queries:

Output

The output of the exercise consists of the java sources which you used to query the ontology, the queries in a separate file, the RDF files, and, finally, a file containing the query results. Please include some comments in the query files to indicate what the query is meant to do.

Reading

3. Extending your ontology to OWL (18 April 2007)

Use the OWL functionality of Protege to extend your ontology with constraints and Boolean class combinations.

In order to use the full OWL functionality of Protege, follow the following steps:

  1. Open your RDFS ontology
  2. Choose File -> Export to Format -> OWL to export your ontology in OWL format.
  3. Close your project
  4. Create a new project of type OWL Files and make sure to check the box Create from Existing Sources.
  5. Select the OWL file which you exported
  6. As default namespace choose http://example.org/name-of-ontology#.
  7. Choose the language profile OWL DL.
  8. Choose the Logic View

Extend the universities using property restrictions and boolean conclusions as you see fit. Make sure you use at least some cardinality restrictions, some existential and universal restrictions and some boolean combinations.

Output

The OWL files of the ontology.

Reading

4. Manipulating your ontology with Jena (02 May 2007)

Use the Jena 2 ontology API to manipulate your ontology using a Java program:

Output

  1. Java sources of the program
  2. OWL and RDF files used as input
  3. Output OWL file

Reading

5. F-Logic Modeling and Reasoning with FLORA-2 (09 May 2007)

Create an F-Logic ontology and use FLORA-2 to reason over this ontology. Consult the FLORA-2 manual to check the actual syntax and the commands to use for loading F-Logic files into FLORA-2 and executing these queries.

Model the following information using FLORA-2 F-Logic syntax:

Write queries to check the following:

Make sure the programs use the extension flr, e.g. myOntology.flr. Load the program in flora using flLoad myOntology. Execute query by entering the body of the query, following by a dot '.', e.g. ?- X:person.

Any term starting with a capital is a variable! Object identifiers start with a lower-case letter!

End every fact and every rule with a dot '.'!

Find an example program here. Queries you might want to try are ?- X:person. and ?- X:singleParent. Find example output for the query ?- X:person. here

Output

  1. FLORA-2 program
  2. A separate file for each query with the query and the answers

Reading

6. Service Discovery with FLORA-2 (16 May 2007)

Use FLORA-2 to model ontologies and services and implement a simple discovery mechanism. A simple services ontology in which services and goals can be described using categories and preconditions/effects can be found here.

The example file also contains services categories in the areas of book selling and computer selling. Additionally, a number of preconditions and effects are given. For simplicity, conditions are simply constants organized in a hierarchy using ::.

The example file additionally contains an example goal description and an example service description, as well as a simple matching mechanism based on categories. You will see that the example goal and service match.

Assignment

  1. Create a service and a goal description which do not match using the simple category mechanism.
  2. Implement a matching mechanism based on preconditions and effects such that if the precondition of the goal is a subclass of the precondition of the service and the effect of the service is a subclass of the effect of the goal, then the service and the goal match.
  3. You will see that the example service and goal do not match using this new matching mechanism. Create two service descriptions with different preconditions and effects which both match with either the example goal or the goal created in step 1.

Output

  1. the extended services.flr

Reading

7. Course Material Review and Exam Preparation (23 May 2007)

Overview of course material for exam

To give an idea of the questions asked at the exam, there is a test exam.