With this article I'm starting the "SciOntology" series in which I'll talk about interesting aspects of ontologies and semantic technologies using examples I hope to be entertaining. I will take for granted that you have installed an ontology editor such as Protégé, or alternatively that you are comfortable with writing ontologies manually and running a reasoner such as Pellet separately. If not, you can take a look at any tutorial you can find online or you can write a comment and I'll be happy to try and help you.
Today I will talk about subproperties with the help of Star Wars characters.
Do you know this quote? Although not entirely correct, it introduces the two main characters of this article: Luke (Skywalker) and Darth Vader. Fire up your preferred ontology editor and create two individuals Luke and Darth_Vader (and optionally give an rdfs:label to each of them with their names), create an object property fatherOf and connect Darth_Vader to Luke using this property. Name the ontology http://www.example.org/starwars and save the file as starwars.ttl. If you prefer to create the file manually, insert the following prefixes:
@prefix : <http://www.example.org/starwars#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
then the following lines:
:Luke rdfs:label "Luke Skywalker" . :Darth_Vader rdfs:label "Darth Vader" . :fatherOf a owl:ObjectProperty . :Darth_Vader :fatherOf :Luke .
Now, run the reasoner on this (very essential) ontology: no additional information is displayed.
A father is only one of the parents of a child, the other parent being a mother. What we are interested in, though, is the fact that a father is also a parent. In description logic parlance we say that "fatherOf is a subproperty of parentOf" and we write:
fatherOf ⊑ parentOf
which is just a fancy way to say that "all fathers are parents" (but not the other way round because there are mothers too). How do we express this in our ontology? By adding the object property parentOf and moving the existing fatherOf property "under" it in the hierarchy (or using the "SubPropertyOf +" button after selecting the fatherOf property, then selecting the parentOf property from the list). If you're writing the ontology manually, you just need to add these two lines to the starwars.ttl file:
:parentOf a owl:ObjectProperty . :fatherOf rdfs:subPropertyOf :parentOf .
Now syncronize (or run manually) the reasoner now. What do you get?
But we don't have to stop here! After all, parents are ancestors too:
parentOf ⊑ ancestorOf
so what happens when you create the ancestorOf property and move the parentOf property under it, declaring parentOf to be a subproperty of ancestorOf, then syncronize the reasoner again?
(which sounds pretty funny, if you ask me, when you imagine it said with Darth Vader's voice.)
Now let's introduce another character, Luke's (lesser known) son Ben Skywalker. Following the same steps, create the individual Ben and say that Luke is Ben's father (i.e. Luke fatherOf Ben). If you run the reasoner you'll see that Luke is not only fatherOf Ben but also parentOf Ben and ancestorOf Ben. This should not be surprising though, given the results of the previous paragraph. Let's add a little twist now by declaring the ancestorOf property as transitive: this is done by checking the "Transitive" checkbox in Protégé or by adding this line in the starwars.ttl file:
:ancestorOf a owl:TransitiveProperty .
Run the reasoner again and check what happened to Darth Vader:
By declaring the property ancestorOf transitive, we are saying: given that Darth Vader is Luke's ancestor and Luke is Ben's ancestor, then Darth Vader is Ben's ancestor too.
I hope you had fun learning about subproperties and transitive properties. The complete ontology is available here. Please feel free to make suggestions!
P.S. I downloaded the original photo from here. I asked for permission to use it but I got no reply. If you think there might be a copyright violation, please let me know.
Share on Twitter Share on Facebook
Comments
Comment awaiting approval 4 years, 1 month ago
Comment awaiting approval 1 year, 9 months ago
Comment awaiting approval 5 months, 1 week ago
Comment awaiting approval 2 months, 4 weeks ago
Comment awaiting approval 1 month, 2 weeks ago
Comment awaiting approval 1 month, 2 weeks ago
Comment awaiting approval 1 month, 2 weeks ago
Comment awaiting approval 1 month, 1 week ago
Comment awaiting approval 1 month, 1 week ago
Comment awaiting approval 1 month, 1 week ago
New Comment