Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Protégé: Creating OWL Properties & Classes, Defining Properties, Subproperties & Inverse, Study Guides, Projects, Research of Computer Science

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

Pre 2010

Uploaded on 08/19/2009

koofers-user-3fu
koofers-user-3fu 🇺🇸

10 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 4
Building An OWL Ontology
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
1. Start Prot´eg´e
2. When the New Pro ject dialog box appears, select OWL Files from the ‘Pro ject
Format’ list section on the left hand side of the dialog box, and press New’.
After a short amount of time, a new empty Prot´eg´e-OWL project will have been created.
4.1 Named Classes
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.
1The 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.
2owl:Thing is part of the OWL Vocabulary, which is defined by the ontology located at http://www.w3.org/2002/07/
owl/\#
16
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Protégé: Creating OWL Properties & Classes, Defining Properties, Subproperties & Inverse and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Chapter 4

Building An OWL Ontology

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

  1. Start Prot´eg´e
  2. When the New Project dialog box appears, select ‘OWL Files’ from the ‘Project Format’ list section on the left hand side of the dialog box, and press ‘New’.

After a short amount of time, a new empty Prot´eg´e-OWL project will have been created.

4.1 Named Classes

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

Create subclass (of

the selected class)

Delete selected class

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

  1. Select the class Pizza in the class hierarchy.
  2. Press the ‘Add siblings’ button on the disjoint classes widget. This will make Pizz- aBase and PizzaTopping (the sibling classes of Pizza) disjoint from Pizza.

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

  1. Select the class PizzaTopping in the class hierarchy.
  2. Use the OWL Wizards to add some subclasses of PizzaTopping called MeatTopping, VegetableTopping, CheeseTopping and also SeafoodTopping. Make sure that these classes are disjoint to each other.
  3. Next add some different kinds of meat topping. Select the class MeatTopping, and use the ‘Create Group Of Classes’ Wizard to add the following subclasses of Meat- Topping: SpicyBeefTopping, PepperoniTopping, SalamiTopping, HamTopping. Once again, ensure that the classes are created as disjoint classes.
  4. Add some different kinds of vegetable toppings by creating the following disjoint sub- classes of VegetableTopping: TomatoTopping, OliveTopping, MushroomTopping, Pep- perTopping, OnionTopping and CaperTopping. Add further subclasses of PepperTop- ping: RedPepperTopping, GreenPepperTopping and JalapenoPepperTopping making sure that the subclasses of PepperTopping are disjoint
  5. Now add some different kinds of cheese toppings. In the same manner as before, add the following subclasses of CheeseTopping, ensuring that the subclasses are disjoint to each other: MozzarellaTopping, and ParmezanTopping
  6. Finally, add some subclasses of SeafoodTopping to represent different kinds of sea food: TunaTopping, AnchovyTopping and PrawnTopping.

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

  1. Switch to the ‘Propterties’ tab. Use the ‘Create Object Property’ button (see Figure 4.13 – second button on the left) to create a new Object property. An Object property with a generic name will be created.
  2. Rename the property to hasIngredient as shown in Figure 4.14 (The ‘Property Name Widget’.

(^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

  1. To create the hasTopping property as a sub property of the hasIngredient property, right click (or ctrl click on the Mac) on the hasIngredient property in the property hierarchy on the ‘Properties’ tab. The menu shown in Figure 4.15 will pop up.
  2. Select the ‘Create subproperty’ item from the popup menu. A new object property will be created as a sub property of the hasIngredient property.
  3. Rename the new property to hasTopping.
  4. Repeat the above steps but name the property hasBase.

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

  1. Select the hasBase property.
  2. Click the ‘Allows multiple values’ tick box on the ‘Property Charachteristics Widget’ so that it is unticked.