Protege4Pizzas10Minutes

From Protege Wiki
Revision as of 11:10, November 13, 2008 by Nickdrummond (talk | contribs) (Initial rough add)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Pizzas in 10 Minutes

A Quick Demonstration of Handy Shortcuts and Features.

by Alan Rector

WORK IN PROGRESS


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. 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. 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) ← Maguerita, 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


Setting up Protégé

Install the appropriate plugins

If you don’t already have them, download the following plugins to your plugins directory

  • Annotation_template
  • Matrix
  • Existential_tree
  • Bookmark
  • OWL-doc

Start Protégé and configure it

  • On the tabs menu tick “Matrix”
  • From the View→Misc Views choose “Annotation Template” view
  • Place it over the class annotation panel
  • Open preferences, and choose description, comment, and label for annotations (plus any others you want).
  • Check the renderer and new-entities tabs in preferences. For most purposes it is best to set them to Auto-ID and User Supplied name. This will provide meaningless IDs for all entities and render them using the label annotation. That way if you exchange ontologies, merely changing labels won’t cause the links between the ontologies to break.
New-entities-preferences.png

The overall setup should now look roughly like this.

TODO SCREENSHOT

If you want to save this set up, use Tabs→ Store current layout. Note this is store so that it will persist with other versions of Protégé-4.


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 “Thing” and Tools→Create_class Hierarchy
  • Create the hierarchy with tabs
Domain_entity
  Independent_entity
  Value

Create the skeleton hierarchy

Create your top classes

  • Select Independent_entity
  • Select Tools→ Create Class Hierarchy…
  • Create Pizza, Pizza_toping, 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 choosing “Add Covering Axiom” from the edit menu.

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.

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

TODO SCREENSHOT

Create the properties

  • Go the Property Matrix tab
  • Create two top properties,
  • Create subproperties of relational_property
    • has_topping, with
    • has_base
  • Create a subproperty of modifier_property
    • has_spiciness, and make it functional by ticking the appropriate box

The object properties tab should now look roughly like

TODO SCREENSHOT

Add the property characteristics

Fill in the table with the appropriate domains and ranges and making has_spiciness and has_base both functional. (You can drag and drop the classes for the domain and range. You can also create new proerties directly in the Matrix pane) The whole tab should then look roughly as shown below:

TODO SCREENSHOT

Add the toppings and the spiciness of toppings

  • Click 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

  • Find the properties in the Object Poperties hierarchy on the right of the tab and drag them to the central pane
  • 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.
    • 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.
    • You can multiselect classes to be dragged.
    • 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 alternatively right click and get a list of values in the range.
  • 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 what is below.

TODO SCREENSHOT

Finish off the pizza definitions

  • Return to the class tab
  • Close the pizzas that have exactly the ingredients given
  • Close Marguerita_pizza and Quatro_formaggi_pizza and Seafood_pizza.

TODO SCREENSHOT

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 class, Spicy_topping
    • Add a restriction, 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)
    • Select Spicy_pizza
    • Add a restriction has_topping some Spicy_topping
    • Make it defined by pressing the short cut key.

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 Vegetarian Pizza, e.g. that it has no meat or fish toppings
  • Add a definition for a Cheesey_pizza, e.g. that it has at least two kinds of chees


Save, Classify and check

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

  • Save your work first!

Anything might go wrong. In fact, if you have been wise you will have been saving your work as went along.

  • Choose a classifier and classify
  • If something turns red, don’t panic. It is probably a disjoint axiom. Check them first.


TODO SCREENSHOT

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/CMND-J to add back the disjoint axioms on all primitive siblings.

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