











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A step-by-step guide on creating and defining object and datatype properties, subproperties, and inverse properties using the protégé-owl ontology editor. It covers the creation of classes, specifying disjoint classes, creating groups of classes, and the different types of owl properties. The document also explains how to create inverse properties and discusses various property characteristics such as functional, inverse functional, transitive, and symmetric properties.
Typology: Study Guides, Projects, Research
1 / 19
This page cannot be seen from the preview
Don't miss anything!
This chapter describes how to create an ontology of Pizzas. We use Pizzas because we have found them to provide many useful examples.^1
Exercise 2: Create a new OWL project
After a short amount of time, a new empty Prot´eg´e-OWL project will have been created.
When Prot´eg´e-OWL starts the OWLClasses tab shown in Figure 4.1 will be visible. The initial class hierarchy tree view should resemble the picture shown in Figure 4.2. The empty ontology contains one class called owl:Thing. As mentioned previously, OWL classes are interpreted as sets of individuals (or sets of objects). The class owl:Thing is the class that represents the set containing all individuals. Because of this all classes are subclasses of owl:Thing.^2
Let’s add some classes to the ontology in order to define what we believe a pizza to be.
(^1) The Ontology that we will created is based upon a Pizza Ontology that has been used as the basis for a course on editing DAML+OIL ontologies in OilEd (http://oiled.man.ac.uk), which was taught at the University Of Manchester. (^2) owl:Thing is part of the OWL Vocabulary, which is defined by the ontology located at http://www.w3.org/2002/07/ owl/#
Figure 4.1: The Classes Tab
Figure 4.2: The Class Hierarchy Pane
Figure 4.4: The Initial Class Hierarchy
Create disjoint class from OWL expression
Add disjointclass
Add all siblings
Remove selected class from list
Delete selected row
Remove all siblings
Figure 4.5: The Disjoint Classes Widget
located in the lower right hand corner of the ‘OWLClasses’ tab is used. (See Figure 4.5).
Exercise 4: Make Pizza , PizzaTopping and PizzaBase disjoint from each other
Notice that the disjoint classes widget now displays PizzaTopping and PizzaBase. Select the class PizzaBase. Notice that the disjoint classes widget displays the classes that are now disjoint to PizzaBase, namely Pizza and PizzaTopping.
Figure 4.6: Add Group Of Classes Wizard: Select class page
Figure 4.7: Add Group Of Classes Wizard: Enter classes page
OWL Classes are assumed to ‘overlap’. We therefore cannot assume that an individual is not a member of a particular class simply because it has not been asserted to be a member of that class. In order to ‘separate’ a group of classes we must make them disjoint from one another. This ensures that an individual which has been asserted to be a member of one of the classes in the group cannot be a member of any other classes in that group. In our above example Pizza, PizzaTopping and PizzaBase have been made disjoint from one another. This means that it is not possible for an individual to be a member of a combination of these classes – it would not make sense for an individual to be a Pizza and a PizzaBase!
If we had imported the Dublin Core ontology (see section 7.2.5) then the Dublin Core annotation properties would have been available to annotate our classes in step 7 Exercise 5. Dublin Core is a set of metadata elements that, in our case, can be used to annotate various elements of an ontology with information such as ‘creator’, ‘date’, ‘language’ etc. For more information see http://dublincore. org/a. aAn ontology will be put into OWL-Full if the ontologies that are available on the Dublin Core website are imported. We recommend that an OWL-DL version of the Dublin Core ontology which is located in the Prot´eg´e ontology library is imported — details of this can be found in section 7.2.
After the ‘Finish’ button has been pressed, the Wizard creates the classes, makes them disjoint, and selects them in the Prot´eg´e OWLClasses tab. The ontology should now have ThinAndCrispyBase and also DeepPanBase as subclasses of PizzaBase. These new classes should also be disjoint to each other. Hence, a pizza base cannot be both thin and crispy and deep pan. It isn’t difficult to see that if we had a lot of classes to add to the ontology, the Wizard would dramatically speed up the process of adding them.
On page two of the ‘Create group of classes wizard’ the classes to be created are entered. If we had a lot of classes to create that had the same prefix or suffix we could use the options to auto prepend and auto append text to the class names that we entered.
Creating Some Pizza Toppings
Now that we have some basic classes, let’s create some pizza toppings. In order to be useful later on the toppings will be grouped into various categories — meat toppings, vegetable toppings, cheese toppings
and seafood toppings.
Exercise 6: Create some subclasses of PizzaTopping
The class hierarchy should now look similar to that shown in Figure 4.8 (the ordering of classes may be slightly different).
Up to this point, we have created some simple named classes, some of which are subclasses of other classes. The construction of the class hierarchy may have seemed rather intuitive so far. However, what does it actually mean to be a sub- class of something in OWL? For example, what does it mean for VegetableTopping to be a subclass of PizzaTopping, or for TomatoTopping to be a subclass of Veg- etableTopping? In OWL subclass means necessary implication. In other words, if VegetableTopping is a subclass of PizzaTopping then ALL instances of Veg- etableTopping are instances of PizzaTopping, without exception — if something is a VegetableTopping then this implies that it is also a PizzaTopping as shown in Figure 4.9.a aIt is for this reason that we seemingly pedantically named all of our toppings with the suffix of ‘Topping’, for example, HamTopping. Despite the fact that class names themselves carry no formal semantics in OWL (and in other ontology languages), if we had named HamTopping Ham, then this could have implied to human eyes that anything that is a kind of ham is also a kind of MeatTopping and also a PizzaTopping.
PizzaTopping
VegetableTopping
TomatoTopping
Figure 4.9: The Meaning Of Subclass — All individuals that are members of the class TomatoTopping are members of the class VegetableTopping and members of the class PizzaTopping as we have stated that TomatoTopping is a subclass of VegetableTopping which is a subclass of PizzaTopping
4.4 OWL Properties
OWL Properties represent relationships between two individuals. There are two main types of properties, Object properties and Datatype properties. Object properties link an individual to an individual. Datatype properties link an individual to an XML Schema Datatype value^3 or an rdf literal 4. OWL also has a third type of property – Annotation properties^5. Annotation properties can be used to add information (metadata — data about data) to classes, individuals and object/datatype properties. Figure 4.10 depicts an example of each type of property.
Properties may be created using the ‘Properties’ tab shown in Figure 4.11. It is also possible to create properties using the ‘Properties Widget’ shown in Figure 4.12 which is located on the ‘OWLClasses’ tab. Figure 4.13 shows the buttons located in the top left hand corner of the ‘Properties’ tab that are used for creating OWL properties. As can be seen from Figure 4.13, there are buttons for creat- ing Datatype properties, Object properties and Annotation properties. Most properties created in this tutorial will be Object properties.
Exercise 7: Create an object property called hasIngredient
(^3) See http://www.w3.org/TR/xmlschema-2/ for more information on XML Schema Datatypes (^4) RDF = Resource Description Framework. See http://www.w3.org/TR/rdf-primer/ for an excellent introduction to RDF. (^5) Object properties and Datatype properties may be marked as Annotation properties
h^ a^ s^ S^ i^ s^ t^ e^ r
Matthew Gemma
An object property linking the individual Matthew to the individual Gemma
A datatype property linking the individual Matthew to the data literal ‘25’, which has a type of an xml:integer.
An annotation property, linking the class ‘JetEngine’ to the data literal (string) ‘’Matthew Horridge’’.
h^ a^ s^ A^ g^ e
Matthew “25”^^xsd:integer
d^ c^ :^ c^ r^ e^ a^ t^ o^ r
JetEngine ‘‘Matthew Horridge’’
Figure 4.10: The Different types of OWL Properties
Create datatype property
Create object property
Create datatype annotation property
Create object annotation property Delete selected property
Figure 4.13: Property Creation Buttons — located on the Properties Tab above the property list/tree
Figure 4.14: Property Name Widget
Although there is no strict naming convention for properties, we recommend that property names start with a lower case letter, have no spaces and have the re- maining words capitalised. We also recommend that properties are prefixed with the word ‘has’, or the word ‘is’, for example hasPart, isPartOf, hasManufacturer, isProducerOf. Not only does this convention help make the intent of the property clearer to humans, it is also taken advantage of by the ‘English Prose Tooltip Generator’a, which uses this naming convention where possible to generate more human readable expressions for class descriptions. aThe English Prose Tooltip Generator displays the description of classes etc. in a more natural form of English, making is easy to understand a class description. The tooltips pop up when the mouse pointer is made to hover over a class description in the user interface.
Having added the hasIngredient property, we will now add two more properties — hasTopping, and hasBase. In OWL, properties may have sub properties, so that it is possible to form hierarchies of properties. Sub properties specialise their super properties (in the same way that subclasses specialise their superclasses). For example, the property hasMother might specialise the more general property of hasParent. In the case of our pizza ontology the properties hasTopping and hasBase should be created as sub properties of hasIngredient. If the hasTopping property (or the hasBase property) links two
individuals this implies that the two individuals are related by the hasIngredient property.
Exercise 8: Create hasTopping and hasBase as sub-properties of hasIngredient
Figure 4.15: PropertyHierarchyMenu
Note that it is also possible to create sub properties of datatype properties. However, it is not possible to mix and match object properties and datatype properties with regards to sub properties. For example, it is not possible to create an object property that is the sub property of a datatype property and vice-versa.
4.5 Inverse Properties
Each object property may have a corresponding inverse property. If some property links individual a to individual b then its inverse property will link individual b to individual a. For example, Figure 4. shows the property hasParent and its inverse property hasChild — if Matthew hasParent Jean, then because of the inverse property we can infer that Jean hasChild Matthew.
Inverse properties can be created/specified using the inverse property widget shown in Figure 4.17. For
Create new inverse property (Create a new property and assigns it to be the inverse of the current property).
Assign existing property (Assign an existing property to be the inverse property of the current property).
Unassign current inverse property
Figure 4.17: The Inverse Property Widget
Figure 4.18: The Property Hierarchy With Inverse Properties
4.6.1 Functional Properties
If a property is functional, for a given individual, there can be at most one individual that is related to the individual via the property. Figure 4.19 shows an example of a functional property hasBirthMother — something can only have one birth mother. If we say that the individual Jean hasBirthMother Peggy and we also say that the individual Jean hasBirthMother Margaret^6 , then because hasBirthMother is a functional property, we can infer that Peggy and Margaret must be the same individual. It should be noted however, that if Peggy and Margaret were explicitly stated to be two different individuals then the above statements would lead to an inconsistency.
Margaret
Peggy
Jean
h^ a^ s^ B
i^ r^ t^ h^ M^ o
t^ h^ e^ r
h a s B i r t h M o t h e r
Implies Peggy and Margaret are the same individual
Figure 4.19: An Example Of A Functional Property: hasBirthMother
Functional properties are also known as single valued properties and also features.
4.6.2 Inverse Functional Properties
If a property is inverse functional then it means that the inverse property is functional. For a given individual, there can be at most one individual related to that individual via the property. Figure 4. shows an example of an inverse functional property isBirthMotherOf. This is the inverse property of hasBirthMother — since hasBirthMother is functional, isBirthMotherOf is inverse functional. If we state that Peggy is the birth mother of Jean, and we also state that Margaret is the birth mother of Jean, then we can infer that Peggy and Margaret are the same individual.
Margaret
Peggy
Implies same individual Jean
i s B ir t h M o t h e r O f
i s^ B^ i^ r^ t^ h^ M
o^ t^ h^ e^ r
O^ f
Figure 4.20: An Example Of An Inverse Functional Property: isBirthMotherOf
4.6.3 Transitive Properties
If a property is transitive, and the property relates individual a to individual b, and also individual b to individual c, then we can infer that individual a is related to individual c via property P. For example, Figure 4.21 shows an example of the transitive property hasAncestor. If the individual Matthew has an
(^6) The name Peggy is a diminutive form for the name Margaret
Unticking this box makes a property functional Ticking this box makes a property Invers Functional
An inverse property may be specified here. Use the ‘O’ button to create a new property and simultaneously make the new property the inverse. Use the ‘O+’ button to add an existing property as the inverse.
Checking this box makes the property symmetric
Checking this box makes the property transitive
Figure 4.23: Property Characteristics Widgets
If a property is transitive then its inverse property should also be transitive.a aAt the time of writing this must be done manually in Prot´eg´e-OWL. However, the reasoner will assume that if a property is transitive, its inverse property is also a transitive.
Note that if a property is transitive then it cannot be functional.a aThe reason for this is that transitive properties, by their nature, may form ‘chains’ of indi- viduals. Making a transitive property functional would therefore not make sense.
We now want to say that out pizza can only have one base. There are numerous ways that this could be accomplished. However, to do this we will make the hasBase property functional, so that it may have only one value for a given individual.
Exercise 11: Make the hasBase property functional