5.E: The Web Ontology Language (Exercises)
- Page ID
- 6425
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Exercise \(\PageIndex{1}\)
How does OWL/OWL 2 differ from a DL language?
Exercise \(\PageIndex{2}\)
Describe what were the motivations to develop OWL 2.
Exercise \(\PageIndex{3}\)
What are the new features in OWL 2 DL compared to OWL-DL?
Exercise \(\PageIndex{4}\)
Which is the required format one has to serialize an OWL ontology in?
Exercise \(\PageIndex{5}\)
List all the species of OWL (both standards).
Exercise \(\PageIndex{6}\)
Which language features can be used on simple object properties only?
Exercise \(\PageIndex{7}\)
What are OWL 2 QL, OWL 2 RL, and OWL 2 EL tailed toward, respectively?
Exercise \(\PageIndex{8}\)
What is the major advantage of the OWL 2 Profiles over OWL 2 DL and OWL 2 full?
Exercise \(\PageIndex{9}\)
Which four ‘parameters’ are considered for complexity of an OWL species?
Exercise \(\PageIndex{10}\)
Describe in one sentence the purpose of DOL.
Exercise \(\PageIndex{11}\)
Complete Table 4.4.1: Verify the question marks in the table (tentatively all “\(–\)”), fill in the dots, and any “\(±\)” should be qualified at to what the restriction is. You may prefer to distribute this exercise among your class mates.
Language & Feature | OWL 1 Lite | OWL 1 DL | OWL 2 DL | OWL 2 Profiles EL | OWL 2 Profiles QL | OWL 2 Profiles RL |
---|---|---|---|---|---|---|
Role Hierarchy | \(+\) | \(+\) | \(+\) | \(\cdot\) | \(+\) | \(\cdot\) |
N-ary roles where \((n\geq 2)\) | \(-\) | \(-\) | \(-\) | \(\cdot\) | \(?\) | \(\cdot\) |
Role Chaining | \(-\) | \(-\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
Role Acyclicity | \(-\) | \(-\) | \(-\) | \(\cdot\) | \(-\) | \(\cdot\) |
Symmetry | \(+\) | \(+\) | \(+\) | \(\cdot\) | \(+\) | \(\cdot\) |
Role Values | \(-\) | \(-\) | \(-\) | \(\cdot\) | \(-\) | \(\cdot\) |
Qualified Number Restrictions | \(-\) | \(-\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
One-of, Enumerated Classes | \(?\) | \(+\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
Functional Dependency | \(+\) | \(+\) | \(+\) | \(\cdot\) | \(?\) | \(\cdot\) |
Covering Constraint over Concepts | \(?\) | \(+\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
Complement of Concepts | \(?\) | \(+\) | \(+\) | \(\cdot\) | \(+\) | \(\cdot\) |
Complement of Roles | \(-\) | \(-\) | \(+\) | \(\cdot\) | \(+\) | \(\cdot\) |
Concept Identification | \(-\) | \(-\) | \(-\) | \(\cdot\) | \(-\) | \(\cdot\) |
Range Typing | \(-\) | \(+\) | \(+\) | \(\cdot\) | \(+\) | \(\cdot\) |
Reflexivity | \(-\) | \(-\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
Antisymmetry | \(-\) | \(-\) | \(-\) | \(\cdot\) | \(-\) | \(\cdot\) |
Transitivity | \(+\) | \(+\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
Asymmetry | \(?\) | \(?\) | \(+\) | \(-\) | \(+\) | \(+\) |
Irreflexivity | \(-\) | \(-\) | \(+\) | \(\cdot\) | \(-\) | \(\cdot\) |
\(\cdot\) | \(\cdot\) | \(\cdot\) | \(\cdot\) | \(\cdot\) | \(\cdot\) | \(\cdot\) |
Table 4.4.1: Partial comparison of some OWL features
Exercise \(\PageIndex{12}\)
Consider some medical ontology. You know that an injury (a cut, a fracture) to a bone in your hand is also an injury to your hand. How can you model this, and similar, information in an OWL 2 DL ontology such that it infers this not only for injuries to hands, but for any injury to any anatomical body part to an injury to its (direct/indirect) whole? Which OWL 2 DL feature do you need for this? Try to formalize it.
- Answer
-
Use a property chain.
Exercise \(\PageIndex{13}\)
Install your ODE of choice, if not already done so, and acquaint yourself with the software. If you installed Protégé (5.x it is in 2018), you may want to have a look at the Pizza Ontology Tutorial (can be downloaded from the Web), but note that it was for a prior Protégé version, so there are slight differences in the screenshots there and the current interface. Also note that the Pizza tutorial was designed with the intention to acquaint the user the tool, not as a cookbook for best practices in ontology development (which it certainly is not).
Exercise \(\PageIndex{14}\)
Several axioms were listed in the chapter. You will now add them to a new ‘test ontology’ and experiment a bit with it.
a. Create a new ontology, give it a new URI, and save it in RDF/XML.
b. Add either \(\texttt{Bicycle}\sqsubseteq\geq\texttt{2 hasComponent.}\top\) or \(\texttt{Bicycle}\sqsubseteq\exists\texttt{hasComponent.Wheel.}\)
c. Take the OWL classifier (see footnote 5) and inspect the least expressive OWL species and violations.
d. Update the previous axiom with the following one: \(\texttt{Bicycle}\sqsubseteq\geq\texttt{2 hasComponent.Wheel}\).
e. Reload the ontology in the OWL classifier and inspect the OWL species and violations. What is the main difference?
f. Experiment in a similar way with one or more of the other axioms listed in the chapter.
- Answer
-
(c) Expressivity: \(\mathcal{ALN}\) , in OWL DL. Not in OWL Lite and OWL 2 EL, QL, RL because of the minCardinality.
(e) Expressivity: \(\mathcal{ALQ}\), in OWL 2 DL. Not in OWL DL anymore because of the qualified number restriction.
Exercise \(\PageIndex{15}\)
Create a new ontology, add the vegan and vegetarian from Exercise 3.4.1, and check both \(\mathcal{O}\vdash Vegan\sqsubseteq Vegetarian\) and \(\mathcal{O}\vdash Vegetarian\sqsubseteq Vegan\). Describe the outcomes.
Exercise \(\PageIndex{16}\)
Have a look at another ontology development environment, e.g., MoKi (at moki.fbk.eu), which uses a semantic wiki.
a. Repeat the previous exercise.
b. Compare the tools by considering, among others: do they both support OWL 2 DL? Which one is easier to navigate? Which one has the most features to help ontology development? Which one is easier for a collaborative ontology development project?
Exercise \(\PageIndex{17}\)
Load university.owl
(note the OWL species) in your ODE, inspect the contents, and try to represent:
a. A \(\texttt{Joint Honors Maths & Computer Science Student}\), who is one who takes both Computer Science and Mathematics modules.
b. A \(\texttt{Single Honors Maths Student}\) (or [Computer Science, Economics]) is one who takes only Maths [Computer Science, Economics] modules.
Is it possible? If yes, how, if not, why not?
- Answer
-
As historical note: the original exercise came from SSSW 20051, which was at the time of OWL 1. The answers here and the next ones have been updated taking into account OWL 2.
(a) The description is sufficiently vague that it may be either of
\(\texttt{JointHonsMathsComp}\equiv\exists\texttt{takes.MathsModule}\sqcap\exists\texttt{takes.ComputerScienceModule}\)
\(\texttt{JointHonsMathsComp}\equiv\texttt{Student}\sqcap\exists\texttt{takes.MathsModule}\sqcap\)
\(\exists\texttt{takes.ComputerScienceModule}\)
In any case, observe it is not “\(\texttt{takes.(MathsModule}\sqcap\texttt{ComputerScienceModule)}\)”; see Example 5.3.3 for further explanation.
(b) \(\texttt{SingleHonsMaths}\equiv\texttt{Student}\sqcap\exists\texttt{takes.MathsModule}\sqcap\forall\texttt{takes.ComputerScienceModule.}\)
This is also called ‘closing’ the axiom.
So: yes, this is possible. A possible solution is shown in
university1.owl
Exercise \(\PageIndex{18}\)
Classify the ontology of the previous question, and describe what happened and changed.
- Answer
-
Deductions: they are undergrad students, and students 2, 4, and 7 are JointHonsMathsComp. Student7 is one, because it is an instance of \(\exists\texttt{takes.MathsModule}\) and has a property assertion that s/he takes CS101.
No student is a SingleHonsMaths, despite that, e.g., Student3 has declared taking two math modules. This is due to the Open World Assumption: student3 may well take other courses that we don’t know of as of yet, so it is not guaranteed in all possible worlds that student3 takes only those two math courses.
Exercise \(\PageIndex{19}\)
The university has a regulation that each undergraduate student must take exactly 2 modules. Add this restriction the the ontology of the previous question.
a. Student 9
takes MT101
, CS101
, and CS102
. Do you think your ontology is consistent? Describe why. Check your answer by adding the student and his courses, run the reasoner and examine the inferences.
b. Student 10
takes MT101
, CS101
, and EC101
. Do you think your ontology is consistent? Describe why. Check your answer by adding the data, running the reasoner, and examining the inferences.
- Answer
-
This can now be done with OWL 2, for it permits qualified number restrictions; see
university2.owl
(a) This poses no problem, because of the no unique name assumption: it will infer that CS101 and CS102 must be the same object, so then student 9 still takes 2 courses and all is well; see
university2.owl
.(b) This does pose a problem, because each of the three courses mentioned are member of their respective classes that are disjoint, so they must be distinct individuals, and thus we obtain a violation in cardinality restrictions (=2 vs =3), and therewith the ontology has become inconsistent.
Exercise \(\PageIndex{20}\)
Open the computerscience.owl
file, find the principal errors in the ontology, and distinguish them from the ‘knock-on’ errors that are merely a consequence of the principal errors. What would you propose to a modeler how to fix it, and why? Note that “fixing” is to be understood as obtaining a satisfiable ontology other than just deleting the unsatisfiable classes.
- Answer
-
Let us first have a look randomly at a deduction and its explanation (click on the “?” right from the deduction in Protégé) as a first step toward figuring out why so many classes are unsatisfiable (i.e., equivalent to
Nothing
, or \(\bot\)). Take the explanation forCS_StudentTakingCourses
:Figure 4.4.1
This
CS_StudentTakingCourses
has a long explanation of why it is unsatisfiable, and we see that some of the axioms that it uses to explain the unsatisfiability also have unsatisfiable classes. Hence, it is a good idea to set this aside for a while, as it is a knock-on effect of the others that are unsatisfiable.Let us have a look at the unsatisfiability regarding departments.
Figure 4.4.2
So, the
AI_Dept
is unsatisfiable because its superclassCS_Department
is, i.e., it is a knock-on effect fromCS_Department
. Does this give sufficient information as to say whyCS_Department
is inconsistent? In fact, it does. See the next screenshot, which is the same as lines3-7
, above.Figure 4.4.3
CS_Department
is unsatisfiable, because it isaffiliatedWith
someCS_Library
that, in turn (by transitivity), isaffiliatedWith
someEE_Library
that belongs to theEE_Department
, which is disjoint fromCS_Department
. Two ‘easy’ options to get rid of this problem are to remove the transitivity or to remove the disjointness. Alternatively, we could revisit the domain knowledge; e.g., CS library may not beaffiliatedWith EE_library
, but is,adjacentTo
or disjoint with the EE library.Let us now consider why
CS_course
is unsatisfiable:Figure 4.4.4
We have again that the real problem is
CS_Department
; fix that one, andCS_course
is satisfiable, too.There is a different issue with
AIStudent
. From the explanation in the next screenshot, we can see immediately it has something to do with the inconsistency ofHCIStudent
.Figure 4.4.5
But looking at
HCIStudent
for a clue does not help us further in isolating the problem:Figure 4.4.6
Considering the axioms in the explanation only, one can argue that the root of the problem is the disjointness between
AIStudent
andHCIStudent
, and remove that axiom to fix it. However, does it really make sense to have the union \(\texttt{ProfessorInHCI}or\texttt{AI}\)? Not really, and therefore it would be a better fix to change that one into two separate classes,ProfessorInHCI
andProfessorInAI
and have them participating in \(\texttt{ProfessorInHCI}\sqsubseteq\forall\texttt{advisorOf.HCIStudent}\) and \(\texttt{ProfessorInAI}\sqsubseteq\forall\texttt{advisorOf.AIStudent}\), respectively.Last, we have a problem of conflicting cardinalities with
LecturerTaking4Courses
: it is a subclass ofTeachingFaculty
, which is restricted to taking at most3
courses, which is in conflict with the “exactly4
” ofLecturerTaking4Courses
. This can be fixed by changing the cardinality of either one, or perhaps a lecturer taking 4 courses is not a sub- but a sister-class ofTeachingFaculty
.Figure 4.4.7
Exercise \(\PageIndex{21}\)
From an educational perspective, you could do Practical Assignment 1 now (see Section A.1) or at the end of Block II. The advantage of doing it now is that you will appreciate the contents of Block II more and can revisit this assignment at the end of Block II, and it gives you a better understanding of both the language features and the automated reasoner. The disadvantage is that it might be harder to do now than at the end of Block II and the quality of the ontology of your first attempt to create one is likely going to be low (which, on the other hand, is a good learning opportunity).