Difference between revisions of "Protege4Pizzas10Minutes"

From Protege Wiki
Jump to: navigation, search
(Setting up Protégé)
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
<div class="orangeBox">
 
<div class="orangeBox">
 
<span class="orangeBoxTitle">Pizzas in 10 Minutes</span><br /><br />
 
<span class="orangeBoxTitle">Pizzas in 10 Minutes</span><br /><br />
A Quick Demonstration of Handy Shortcuts and Features.
+
A Quick Demonstration of Handy Shortcuts and Features for Protege 4,5 and newer.
  
 
by Alan Rector
 
by Alan Rector
 +
</div><br />
  
WORK IN PROGRESS
+
'''Back to [[Protege4UserDocs|Protege Desktop User Documentation]]'''
 
 
</div><br />
 
  
 
__TOC__
 
__TOC__
Line 13: Line 12:
 
== Introduction ==
 
== Introduction ==
  
Protégé-4 is a powerful editing environment with many features. So many features that many users have not found most of them. This is a quick trip through how to build our standard Pizza ontology in 10 minutes or less of actual typing.
+
Protégé is a powerful editing environment with many features. So many features that many users have not found most of them. This is a quick trip through how to build our standard Pizza ontology in 10 minutes or less of actual typing.
We assume you have already done the Pizza Ontology ??URL?? or attended one of our tutorials. That tutorial is intended to teach you about OWL. This brief note is to show how to use Protégé efficiently.
+
 
 +
If you have any problems with this walkthrough it is advised that you download and run through the much more substantial [http://owl.cs.manchester.ac.uk/publications/talks-and-tutorials/protg-owl-tutorial/ Protege OWL tutorial].
 +
That tutorial is intended to teach you about OWL. This brief note is to show how to use Protégé efficiently.
 +
 
 
We assume you already know what you are doing and have a list of the main elements of the ontology written down in pencil or sketched in a text editor, mind-map, concept map or whatever tool you prefer.  
 
We assume you already know what you are doing and have a list of the main elements of the ontology written down in pencil or sketched in a text editor, mind-map, concept map or whatever tool you prefer.  
(Of course you have to have done the thinking first. This is just how to get the results of thinking into Protégé as easily as possible.)
+
(Of course you have to have done the thinking first. This is just how to get the results of thinking into Protégé as easily as possible.)
  
 
== We assume you have a basic structure already defined “on paper” ==
 
== We assume you have a basic structure already defined “on paper” ==
Line 28: Line 30:
 
* Pizza_base ← Thick_crust, Thin_crust,…
 
* Pizza_base ← Thick_crust, Thin_crust,…
 
* Pizza_topping ← Tomato_topping, Mozarella_topping, Spicy_beef_toping, Pepperoni_topping, …
 
* Pizza_topping ← Tomato_topping, Mozarella_topping, Spicy_beef_toping, Pepperoni_topping, …
* Pizzas (primitive) ← Maguerita,  Hot_and_spicy, Seafood, …
+
* Pizzas (primitive) ← Margherita,  Hot_and_spicy, Seafood, …
 
* Pizzas (define) Vegetarian*,  Cheesey*
 
* Pizzas (define) Vegetarian*,  Cheesey*
  
It is useful for a very fast version to know which are going to be defined classes deal with primitive and defined classes separately.
+
It is useful for a very fast version to know which are going to be defined classes. -- deal with primitive and defined classes separately.
  
 
=== A list of the properties and their domain and ranges ===
 
=== A list of the properties and their domain and ranges ===
Line 40: Line 42:
  
 
== Start Protégé and configure it ==
 
== Start Protégé and configure it ==
 +
 +
Before beginning this part of the tutorial please familiarise yourself with Protege Desktop with the [[Protege4GettingStarted|Quick start Guide]].
 +
  
 
=== Install the appropriate plugins ===
 
=== Install the appropriate plugins ===
  
If you don’t already have them, download the following plugins to your plugins directory
+
If you don’t already have them, download and unzip the following plugins into your plugins directory
 
* [http://code.google.com/p/co-ode-owl-plugins/wiki/AnnotationTemplate Annotation template]
 
* [http://code.google.com/p/co-ode-owl-plugins/wiki/AnnotationTemplate Annotation template]
 
* [http://code.google.com/p/co-ode-owl-plugins/wiki/MatrixViews Matrix]
 
* [http://code.google.com/p/co-ode-owl-plugins/wiki/MatrixViews Matrix]
  
=== Start P4 and create a new ontology ===
 
  
* Start P4 (preferably from a shell using one of the scripts provided, as this will give you additional feedback)
+
=== Start Protege and create a new ontology ===
 +
 
 +
* Start Protege (preferably from a shell using one of the scripts provided, as this will give you additional feedback)
 
* Select '''Create new OWL ontology'''
 
* Select '''Create new OWL ontology'''
 
* Give the ontology a pizza-related URI
 
* Give the ontology a pizza-related URI
 
* Specify where you wish to save the ontology
 
* Specify where you wish to save the ontology
 +
  
 
=== Configure the UI ===
 
=== Configure the UI ===
Line 59: Line 66:
  
 
==== Setup tabs you will need (and not need) ====
 
==== Setup tabs you will need (and not need) ====
* Enable the matrix views '''Tabs | Matrix''' and '''Tabs | Property Matrix''' that will be used later for fast entry
+
* Enable the matrix views '''Window | Tabs | Matrix''' and '''Window | Tabs | Property Matrix''' that will be used later for fast entry
 
* Disable the individuals, object and data property and classes tabs (you can use the entities tab for all of these)
 
* Disable the individuals, object and data property and classes tabs (you can use the entities tab for all of these)
  
Line 66: Line 73:
 
* Open preferences ('''File | Preferences''' on windows, '''Protege | Preferences''' on mac)
 
* Open preferences ('''File | Preferences''' on windows, '''Protege | Preferences''' on mac)
 
* Select the '''new entities''' tab
 
* Select the '''new entities''' tab
* In the '''Entity URI''' pane, select '''auto ID'''. When you create a new class, property or individual P4 will give it a meaningless URI and a readable label. That way if you exchange ontologies, correcting spelling mistakes (by merely changing labels) won’t cause the links between the ontologies to break
+
* In the '''Entity URI''' pane, select '''auto ID'''. When you create a new class, property or individual, Protege will give it a meaningless URI and a readable label. That way if you exchange ontologies, correcting spelling mistakes (by merely changing labels) won’t cause the links between the ontologies to break
 
* Select the '''renderer''' tab
 
* Select the '''renderer''' tab
 
* Select '''Render entities using annotation values'''
 
* Select '''Render entities using annotation values'''
Line 72: Line 79:
  
 
==== Setup the entities tab ====
 
==== Setup the entities tab ====
 +
 
* Select the entities tab
 
* Select the entities tab
* Add the alternative annotations view from '''View | Misc Views | “Annotation Template''' somewhere convenient
+
* Add the annotation template view from '''View | Misc Views | “Annotation Template''' in the top part of the right hand pane (see [[Protege4GettingStarted#Reconfigure_the_User_Interface|configuring the interface]] if you've not done this before).
* In '''Preferences | Annotation Template''' you can change the default fields that are visible on this template
 
  
The overall setup should now look roughly like this.
+
The default fields in the annotations view should be suitable but if you wish to change them you can do this in '''Preferences | Annotation Template'''
  
'''TODO SCREENSHOT'''
+
If you want to save this set up, use '''Tabs | Store current layout'''.  Note when you quit Protege this is automatically stored and will persist for future versions of Protege.
 
 
If you want to save this set up, use '''Tabs | Store current layout'''.  Note when you quit P4 this is automatically stored and will persist for future versions of P4.
 
  
 
<br style="clear: both;" />
 
<br style="clear: both;" />
Line 88: Line 93:
 
=== Create the top hierarchy ===
 
=== Create the top hierarchy ===
  
You don’t need to do this, but for a variety of reasons it is “good practice”.
+
You don’t need to do this, but for a variety of reasons it is “good practice”.
* Select “Thing” and Tools→Create_class Hierarchy
+
* Select the entities tab
* Create the hierarchy with tabs
+
* Make sure '''Thing''' is selected in the class hierarchy
 +
* Select '''Tools | Create class hierarchy'''
 +
* Create the hierarchy with tab indenting to denote subclasses:
  
 
  Domain_entity
 
  Domain_entity
Line 100: Line 107:
 
==== Create your top classes ====
 
==== Create your top classes ====
  
* Select Independent_entity
+
* Select '''Independent_entity'''
* Select Tools→ Create Class Hierarchy…
+
* Select '''Tools | Create Class Hierarchy...'''
* Create Pizza, Pizza_toping, and Pizza_base
+
* Create Pizza, Pizza_topping, and Pizza_base
 
(If you want you can create the entire hierarchy here using tabs to indicate the hierarchy, but if you do you can’t take advantage of the automatic suffix mechanism and will have to type “_base”, “_topping”, “_pizza” for each entity by hand.)
 
(If you want you can create the entire hierarchy here using tabs to indicate the hierarchy, but if you do you can’t take advantage of the automatic suffix mechanism and will have to type “_base”, “_topping”, “_pizza” for each entity by hand.)
* Finish the wizard and leave “Make classes disjoint” box ticked
+
* Finish the wizard and leave '''Make classes disjoint''' box ticked
  
 
==== Create each branch of the taxonomy ====
 
==== Create each branch of the taxonomy ====
  
 
* Select Pizza_topping
 
* Select Pizza_topping
* Select Tools Create Class Hierarchy …
+
* Select '''Tools | Create Class Hierarchy…'''
* In the “Suffix” box type “_topping”
+
* In the '''Suffix''' box type “_topping”
 
* Enter the list of toppings and finish as before, using tabs to indicate subclasses
 
* Enter the list of toppings and finish as before, using tabs to indicate subclasses
 
* Repeat for Pizza_base
 
* Repeat for Pizza_base
* Repeat for Pizza, but untick “Make classes disjoint” because we will make some of these classes defined, so we will add the disjoints afterwards.
+
* Repeat for Pizza, but untick '''Make classes disjoint''' because we will make some of these classes defined, so we will add the disjoints afterwards.
 
* Select Value and create the hierarchy for Spiciness← Hot, Medium, Mild, all with the suffix “_value”
 
* Select Value and create the hierarchy for Spiciness← Hot, Medium, Mild, all with the suffix “_value”
* Close the value partition by selecting Spiciness_value and choosing “Add Covering Axiom” from the edit menu.
+
* Close the value partition by selecting Spiciness_value and select '''Edit | Add covering axiom''' 
  
 
==== Open the class hierarchy and check ====
 
==== Open the class hierarchy and check ====
Line 122: Line 129:
 
* Type convenient descriptions in the kinds of pizzas and anything else that is not unambiguous or will be defined.
 
* Type convenient descriptions in the kinds of pizzas and anything else that is not unambiguous or will be defined.
  
My ontology now looks as show below for one choice of toppings and kinds of pizza
+
The ontology now looks as show below for one choice of toppings and kinds of pizza.
  
'''TODO SCREENSHOT'''
+
[[Image:Alr-initial-hierarchy.png|400px]]
  
=== Create the properties ===
+
=== Create the object properties ===
  
* Go the Property Matrix tab
+
* In the object properties view create two top object properties  
* Create two top properties,
+
  relational_property
 +
  modifier_property
 
* Create subproperties of relational_property
 
* Create subproperties of relational_property
** has_topping, with
+
  has_topping
** has_base
+
  has_base
 
* Create a subproperty of modifier_property
 
* Create a subproperty of modifier_property
** has_spiciness, and make it functional by ticking the appropriate box
+
  has_spiciness
  
 
The object properties tab should now look roughly like  
 
The object properties tab should now look roughly like  
  
'''TODO SCREENSHOT'''
+
[[Image:Alr-initial-objproperties.png]]
  
 
==== Add the property characteristics ====
 
==== Add the property characteristics ====
  
Fill in the table with the appropriate domains and ranges and making has_spiciness and has_base both functional. 
+
* Go the '''Property Matrix''' tab
(You can drag and drop the classes for the domain and range.  You can also create new proerties directly in the Matrix pane)
+
* Make has_spiciness and has_base both functional
 +
* Fill in the appropriate domains and ranges for each property (You can drag and drop classes from the classes palette into the domain and range)
 +
 
 
The whole tab should then look roughly as shown below:
 
The whole tab should then look roughly as shown below:
  
'''TODO SCREENSHOT'''
+
[[Image:Alr-matrix-objproperties.png]]
  
 
=== Add the toppings and the spiciness of toppings ===
 
=== Add the toppings and the spiciness of toppings ===
  
* Click the Matrix tab
+
* Go to the '''Matrix tab'''
(Optional additional setup.  You may find it easier to have an additional class description view at the bottom of the matrix tab as shown at the end of this section. If so, go to Views→ Class views, select Class Description, and place it in the bottom half so it goes under the main part of the matrix tab. If you want another view to the left to make it look better you can put one there as well.  I usually use inferred superclass hierarchy.)
+
 
Add the properties has_topping and has_spiciness to the matrix
+
Optional additional setup.  You may find it easier to have an additional class description view at the bottom of the matrix tab as shown at the end of this section.  
* Find the properties in the Object Poperties hierarchy on the right of the tab and drag them to the central pane
+
If so, go to '''View | Class views | Class Description''', and place it in the bottom half so it goes under the main part of the matrix tab.
* Float the class pane in the lower right  by clicking on the round icon second from the right.
+
 
* You can now drag and drop values into the categories. 
+
* Add columns for the properties has_topping and has_spiciness to the matrix
** You can multiselect the target classes, but it is best to do it over the class names themselves. Selecting the space brings up a drop down menu if there is arrange specified.
+
** Find the properties in the '''Object properties palette''' on the right of the tab and drag them to the central pane
** You can multiselect classes to be dragged.
+
* Add Mild, Medium or Hot for the various pizza toppings
** If you make a mistake you can either delete the item in place, or you can change it in the class descrition window if you have placed it at the bottom
+
** You can now drag and drop values into the matrix - each comma-separated value in a cell is the filler of a someValuesFrom restriction on the class along the property
* You can alternatively right click and get a list of values in the range.
+
*** You can multiselect the target classes in order to add the same value to multiple cells at once
* You only need to drag values to parent classes as they will be inherited.  
+
*** You can multiselect filler classes to be dragged
 +
** It might be quicker to edit the cells in place - click a cell and start typing
 +
*** the editor support autocomplete just like expression editors (Ctrl-Space)
 +
*** separate fillers with commas
 +
** If you make a mistake you can either delete the item in place, or you can change it in the class description window if you have placed it at the bottom
 +
** You only need to drag values to parent classes as they will be inherited.
 
* Add the basic toppings to the Pizzas as well, except for the classes that will have definitions, Vegetarian Pizza, Spicy Pizza, and Cheesy Pizza.
 
* Add the basic toppings to the Pizzas as well, except for the classes that will have definitions, Vegetarian Pizza, Spicy Pizza, and Cheesy Pizza.
  
At the end you should see roughly what is below.
+
At the end you should see roughly as below:
 
   
 
   
'''TODO SCREENSHOT'''
+
[[Image:Alr-matrix-classes.png]]
  
 
=== Finish off the pizza definitions ===
 
=== Finish off the pizza definitions ===
Line 171: Line 186:
 
* Return to the class tab
 
* Return to the class tab
  
* Close the pizzas that have exactly the ingredients given
+
* Close the pizzas toppings so that no others can be added
* Close Marguerita_pizza and Quatro_formaggi_pizza and Seafood_pizza.
+
** Close Margherita_pizza
 
+
*** Select Margherita_pizza
'''TODO SCREENSHOT'''
+
*** right click on one of the has_topping restrictions in the '''Description''' view (on the mac you might need to first select the restriction, then right click).
 +
*** In the menu that appears select '''Create closure axiom'''. This creates an AllValuesFrom restriction along the property in the restriction you selected. The filler of this new restriction will be a union of all the fillers along this property.
 +
** Repeat for Quatro_formaggi_pizza and Seafood_pizza.
  
 
==== Add the definitions for the defined classes based on existentials ====
 
==== Add the definitions for the defined classes based on existentials ====
Line 180: Line 197:
 
It is usually easier to create defined classes by creating the restrictions individually and then convert it the result to a defined class.
 
It is usually easier to create defined classes by creating the restrictions individually and then convert it the result to a defined class.
 
If you don’t want to use all the restrictions in the definitions, just select the ones you do want to convert, right click and use the convert).
 
If you don’t want to use all the restrictions in the definitions, just select the ones you do want to convert, right click and use the convert).
** Create a class, Spicy_topping
+
** Create a sublclass of Pizza_topping, Spicy_topping
** Add a restriction, has_spiciness some Hot_value
+
** Add a superclass in the description view, ''has_spiciness some Hot_value''
** Choose Edit→ Convert to defined class (or press the short cut key – CMND-D on the Mac, CTRL-D on a Windows)
+
** Choose '''Edit | Convert to defined class''' (or press the short cut key – '''CMD-D''' on the Mac, '''CTRL-D''' on a Windows). All superclasses are merged into a single equivalent class - you will see this move in the description view
** Select Spicy_pizza
+
** Select or create a Spicy_pizza
** Add a restriction has_topping some Spicy_topping
+
** Add a superclass in the description view, ''has_topping some Spicy_topping''
** Make it defined by pressing the short cut key.
+
** Make it defined by pressing '''CMD-D''' or '''CTRL-D'''.
  
 
==== Add the definitions for other defined classes ====
 
==== Add the definitions for other defined classes ====
  
 
If the definitions are more complicated, e.g.  for Vegetarian Pizza, then you just have to do it the long way.  It is still probably easier to add them as individual restrictions and then convert to a defined class
 
If the definitions are more complicated, e.g.  for Vegetarian Pizza, then you just have to do it the long way.  It is still probably easier to add them as individual restrictions and then convert to a defined class
* Add a definition for Vegetarian Pizza, e.g. that it has no meat or fish toppings
+
* Add a definition for a Cheesey_pizza = ''Pizza and has_topping min 2 Cheese_topping'' e.g. that it has at least two kinds of cheese
* Add a definition for a Cheesey_pizza, e.g.  that it has at least two kinds of chees
+
* Add a definition for Vegetarian Pizza = ''Pizza and not(has_topping some (Meat_topping or Fish_topping))'' e.g.  that it has no meat or fish toppings
  
 +
== Save, Classify and check ==
  
== Save, Classify and check ==
+
[[Image:Alr-classified-hierarchy.png|right|400px]]
  
 
The ontology isn’t complete until it’s been classified and checked!
 
The ontology isn’t complete until it’s been classified and checked!
* Save your work first!  
+
* Save your work first! In fact, if you have been wise you will have been saving your work as went along.
Anything might go wrong.  In fact, if you have been wise you will have been saving your work as went along.
+
* Choose a reasoner from the Reasoner menu. This will automatically cause the reasoner to classify your ontology.
* Choose a classifier and classify
 
 
* If something turns red, don’t panic.  It is probably a disjoint axiom.  Check them first.
 
* If something turns red, don’t panic.  It is probably a disjoint axiom.  Check them first.
 
 
'''TODO SCREENSHOT'''
 
  
 
== Making corrections ==
 
== Making corrections ==
  
It is the disjoint axioms that are troublesome. If you are changing the class hierarchy:
+
It is the disjoint axioms that are troublesome. If you are changing the class hierarchy:
 
* If you are moving a class, first remove its disjoint axioms.  They will almost certainly be wrong for its new location
 
* If you are moving a class, first remove its disjoint axioms.  They will almost certainly be wrong for its new location
* When you are finished, go to a sibling class with disjoint axioms, remove the long disjoint axiom and press CTRL-J/CMND-J to add back the disjoint axioms on all primitive siblings.
+
* When you are finished, go to a sibling class with disjoint axioms, remove the long disjoint axiom and press '''CTRL-J'''/'''CMD-J''' to add back the disjoint axioms on all primitive siblings.
 +
 
 
Anything else, just fix in the usual Class Description view.
 
Anything else, just fix in the usual Class Description view.
 +
 +
 +
'''Back to [[Protege4UserDocs|Protege Desktop User Documentation]]'''

Latest revision as of 19:32, May 23, 2016

Pizzas in 10 Minutes

A Quick Demonstration of Handy Shortcuts and Features for Protege 4,5 and newer.

by Alan Rector


Back to Protege Desktop User Documentation

Introduction

Protégé is a powerful editing environment with many features. So many features that many users have not found most of them. This is a quick trip through how to build our standard Pizza ontology in 10 minutes or less of actual typing.

If you have any problems with this walkthrough it is advised that you download and run through the much more substantial Protege OWL tutorial. That tutorial is intended to teach you about OWL. This brief note is to show how to use Protégé efficiently.

We assume you already know what you are doing and have a list of the main elements of the ontology written down in pencil or sketched in a text editor, mind-map, concept map or whatever tool you prefer. (Of course you have to have done the thinking first. This is just how to get the results of thinking into Protégé as easily as possible.)

We assume you have a basic structure already defined “on paper”

Main categories

  • Pizza
  • Pizza_base
  • Pizza_topping

Lists of each kind of main topic

  • Pizza_base ← Thick_crust, Thin_crust,…
  • Pizza_topping ← Tomato_topping, Mozarella_topping, Spicy_beef_toping, Pepperoni_topping, …
  • Pizzas (primitive) ← Margherita, Hot_and_spicy, Seafood, …
  • Pizzas (define) Vegetarian*, Cheesey*

It is useful for a very fast version to know which are going to be defined classes. -- deal with primitive and defined classes separately.

A list of the properties and their domain and ranges

  • has_topping
  • has_base


Start Protégé and configure it

Before beginning this part of the tutorial please familiarise yourself with Protege Desktop with the Quick start Guide.


Install the appropriate plugins

If you don’t already have them, download and unzip the following plugins into your plugins directory


Start Protege and create a new ontology

  • Start Protege (preferably from a shell using one of the scripts provided, as this will give you additional feedback)
  • Select Create new OWL ontology
  • Give the ontology a pizza-related URI
  • Specify where you wish to save the ontology


Configure the UI

New-entities-preferences.png

Setup tabs you will need (and not need)

  • Enable the matrix views Window | Tabs | Matrix and Window | Tabs | Property Matrix that will be used later for fast entry
  • Disable the individuals, object and data property and classes tabs (you can use the entities tab for all of these)


Setup the renderer and how new entities will be created

  • Open preferences (File | Preferences on windows, Protege | Preferences on mac)
  • Select the new entities tab
  • In the Entity URI pane, select auto ID. When you create a new class, property or individual, Protege will give it a meaningless URI and a readable label. That way if you exchange ontologies, correcting spelling mistakes (by merely changing labels) won’t cause the links between the ontologies to break
  • Select the renderer tab
  • Select Render entities using annotation values


Setup the entities tab

  • Select the entities tab
  • Add the annotation template view from View | Misc Views | “Annotation Template in the top part of the right hand pane (see configuring the interface if you've not done this before).

The default fields in the annotations view should be suitable but if you wish to change them you can do this in Preferences | Annotation Template

If you want to save this set up, use Tabs | Store current layout. Note when you quit Protege this is automatically stored and will persist for future versions of Protege.


Build the ontology

Create the top hierarchy

You don’t need to do this, but for a variety of reasons it is “good practice”.

  • Select the entities tab
  • Make sure Thing is selected in the class hierarchy
  • Select Tools | Create class hierarchy
  • Create the hierarchy with tab indenting to denote subclasses:
Domain_entity
  Independent_entity
  Value

Create the skeleton hierarchy

Create your top classes

  • Select Independent_entity
  • Select Tools | Create Class Hierarchy...
  • Create Pizza, Pizza_topping, and Pizza_base

(If you want you can create the entire hierarchy here using tabs to indicate the hierarchy, but if you do you can’t take advantage of the automatic suffix mechanism and will have to type “_base”, “_topping”, “_pizza” for each entity by hand.)

  • Finish the wizard and leave Make classes disjoint box ticked

Create each branch of the taxonomy

  • Select Pizza_topping
  • Select Tools | Create Class Hierarchy…
  • In the Suffix box type “_topping”
  • Enter the list of toppings and finish as before, using tabs to indicate subclasses
  • Repeat for Pizza_base
  • Repeat for Pizza, but untick Make classes disjoint because we will make some of these classes defined, so we will add the disjoints afterwards.
  • Select Value and create the hierarchy for Spiciness← Hot, Medium, Mild, all with the suffix “_value”
  • Close the value partition by selecting Spiciness_value and select Edit | Add covering axiom

Open the class hierarchy and check

  • If you have made any spelling errors you can just correct them in the label field
  • Type convenient descriptions in the kinds of pizzas and anything else that is not unambiguous or will be defined.

The ontology now looks as show below for one choice of toppings and kinds of pizza.

Alr-initial-hierarchy.png

Create the object properties

  • In the object properties view create two top object properties
 relational_property
 modifier_property
  • Create subproperties of relational_property
 has_topping
 has_base
  • Create a subproperty of modifier_property
 has_spiciness

The object properties tab should now look roughly like

Alr-initial-objproperties.png

Add the property characteristics

  • Go the Property Matrix tab
  • Make has_spiciness and has_base both functional
  • Fill in the appropriate domains and ranges for each property (You can drag and drop classes from the classes palette into the domain and range)

The whole tab should then look roughly as shown below:

Alr-matrix-objproperties.png

Add the toppings and the spiciness of toppings

  • Go to the Matrix tab

Optional additional setup. You may find it easier to have an additional class description view at the bottom of the matrix tab as shown at the end of this section. If so, go to View | Class views | Class Description, and place it in the bottom half so it goes under the main part of the matrix tab.

  • Add columns for the properties has_topping and has_spiciness to the matrix
    • Find the properties in the Object properties palette on the right of the tab and drag them to the central pane
  • Add Mild, Medium or Hot for the various pizza toppings
    • You can now drag and drop values into the matrix - each comma-separated value in a cell is the filler of a someValuesFrom restriction on the class along the property
      • You can multiselect the target classes in order to add the same value to multiple cells at once
      • You can multiselect filler classes to be dragged
    • It might be quicker to edit the cells in place - click a cell and start typing
      • the editor support autocomplete just like expression editors (Ctrl-Space)
      • separate fillers with commas
    • If you make a mistake you can either delete the item in place, or you can change it in the class description window if you have placed it at the bottom
    • You only need to drag values to parent classes as they will be inherited.
  • Add the basic toppings to the Pizzas as well, except for the classes that will have definitions, Vegetarian Pizza, Spicy Pizza, and Cheesy Pizza.

At the end you should see roughly as below:

Alr-matrix-classes.png

Finish off the pizza definitions

  • Return to the class tab
  • Close the pizzas toppings so that no others can be added
    • Close Margherita_pizza
      • Select Margherita_pizza
      • right click on one of the has_topping restrictions in the Description view (on the mac you might need to first select the restriction, then right click).
      • In the menu that appears select Create closure axiom. This creates an AllValuesFrom restriction along the property in the restriction you selected. The filler of this new restriction will be a union of all the fillers along this property.
    • Repeat for Quatro_formaggi_pizza and Seafood_pizza.

Add the definitions for the defined classes based on existentials

It is usually easier to create defined classes by creating the restrictions individually and then convert it the result to a defined class. If you don’t want to use all the restrictions in the definitions, just select the ones you do want to convert, right click and use the convert).

    • Create a sublclass of Pizza_topping, Spicy_topping
    • Add a superclass in the description view, has_spiciness some Hot_value
    • Choose Edit | Convert to defined class (or press the short cut key – CMD-D on the Mac, CTRL-D on a Windows). All superclasses are merged into a single equivalent class - you will see this move in the description view
    • Select or create a Spicy_pizza
    • Add a superclass in the description view, has_topping some Spicy_topping
    • Make it defined by pressing CMD-D or CTRL-D.

Add the definitions for other defined classes

If the definitions are more complicated, e.g. for Vegetarian Pizza, then you just have to do it the long way. It is still probably easier to add them as individual restrictions and then convert to a defined class

  • Add a definition for a Cheesey_pizza = Pizza and has_topping min 2 Cheese_topping e.g. that it has at least two kinds of cheese
  • Add a definition for Vegetarian Pizza = Pizza and not(has_topping some (Meat_topping or Fish_topping)) e.g. that it has no meat or fish toppings

Save, Classify and check

Alr-classified-hierarchy.png

The ontology isn’t complete until it’s been classified and checked!

  • Save your work first! In fact, if you have been wise you will have been saving your work as went along.
  • Choose a reasoner from the Reasoner menu. This will automatically cause the reasoner to classify your ontology.
  • If something turns red, don’t panic. It is probably a disjoint axiom. Check them first.

Making corrections

It is the disjoint axioms that are troublesome. If you are changing the class hierarchy:

  • If you are moving a class, first remove its disjoint axioms. They will almost certainly be wrong for its new location
  • When you are finished, go to a sibling class with disjoint axioms, remove the long disjoint axiom and press CTRL-J/CMD-J to add back the disjoint axioms on all primitive siblings.

Anything else, just fix in the usual Class Description view.


Back to Protege Desktop User Documentation