Professional Documents
Culture Documents
Ow Lap I Introduction Tasks
Ow Lap I Introduction Tasks
Ow Lap I Introduction Tasks
Create a new Java project using your favourite IDE (ideally Eclipse)
Create a new package owl.cs.man.ac.uk.owltutorial
Create a new Class inside that package OWLAPITutorial, include a main method
Add the OWLAPI version 3.4.8 (owlapi-distribution-3.4.8.jar) to your class path
In the Build Path Dialogue, you may want to add the source jar to the respective entry
underneath the library. That way you can inspect the OWLAPI classes when using them (see
following 2 screenshots)
6. To check whether all went well, write the following code inside the main method:
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
IRI ontologyIRI = IRI.create("http://130.88.198.11/co-odefiles/ontologies/pizza.owl");
try {
7. When you execute the program, you should be able to see the axiom count: 712.
Congratulations. You have just conquered mount Olympus.
8. For every task in the following, we recommend you to create a new class with some sensible
name (OWLAPITutorialTask1) , copy the test code mentioned in the Basic Project Setup into
it and go from there.
Task 5: Reasoning I
We have discussed reasoners in class. Lets see what the reasoner can tell us about our ontology.
Copy the Java class from Task2 ideally, and go from there.
1) Create a new ontology with at least two satisfiable classes and one unsatisfiable class. Tip:
the easiest way to do that is to make a class a subclass of the intersection of two disjoint
classes. One suggestion (the thing that will be demonstrated later on) is to use a Student and
2)
3)
4)
5)
Teacher class, make them disjoint and make a class like Demonstrator a subclass of their
intersection.
Instantiate a reasoner and determine whether your ontology is consistent. Should it be?
Print the list of unsatisfiable classes to the console.
Create an individual and make it an instance of the unsatisfiable class in the way we
discussed it before.
Check whether the ontology is consistent and explain why.
Task 6: Reasoning II
Now that we know how to instantiate the reasoner, lets see if we can do something useful with it.
1) Copy the Task4 class to a new Task6 class.
2) Instantiate the reasoner again in the same way as we did in Task 5.
3) The question is: Is the person X you created a student or not?
a. Try to find this out using the OWLOntology interface alone. Dont spend more than 7
minutes on this and move on.
b. Ask the reasoner the same question (use the OWLReasoner interface)i.
4) If you are bored, play with the reasoner interface and see what other cool things you can do
with it (queries similar to the once in the DLQuery tab in Protg, print the reasoner name, and
so on).
Task 7: Annotations
A last task for those that have finished all the rest is the following. It is a bit tricky, I do not really
expect anyone to solve it in the short amount of time left:
1)
2)
3)
4)
Should this not work, run reasoner.precomputeInferences() and ask the reasoner again.