6) Working with Protege
If you are not acquainted with Protege, this tutorial will
provide you with all the knowledge that you need to use the DAML+OIL Plug-in,
however more information is available at the
Protege site. See
Section 7 for information on current restrictions.
The Protege GUI utilizes the following buttons.

Their meanings are as follows:
View
Create new class, slot, etc.
Add existing class, slot,
etc.
Remove
Delete
Create a copy
New
classes in DAML+OIL should be subclasses of daml_oil:Thing, since everything is a
"Thing" in DAML+OIL. Follow the instructions for subclassing below, and
subclass off of daml_oil:Thing to create all of your basic classes.
- Creating subclasses can be done in one of two ways from within the Classes
tab.
- The first method is to right click on the class you want to subclass and
pressing Create subclass

- The other way is to select the class that you wish to create subclasses
of, and press the Create Button:
at the top of the
classes tab. (The tool tip reads create subclass.)
- Once you've done this you'll have a new class who's name begins with "KB_"

- You may give your class a new name in the Name field, or leave the name as
it is.
- Any class who's name begins with "KB_" will be made into an anonymous
class upon serialization. This means the class will not get an rdf:ID.
Multiple inheritance
- To add more superclasses to a class press the add button
of the Superclasses field at the
bottom of the Classes tab.

DAML+OIL
Properties are mapped to Slots in Protege. This tutorial will use Property to
refer to
the daml_oil:Property and Slot to refer to the Protege representation.
- Creating Slots can be done one of two ways from the Slots tab.
- One way is to use the Create Button:
at the top of the
Slots tab window.
- The other way is to right click on any slot listed in the Slots tab and
select Create slot

- The slot has a default name that you can change in the name field

- Now you have a new Slot. In the current version the default rangeType is
Instance. This means that the range of the property will be a class.
We explain below how this can be used to specify properties that have
user-defined classes as their range as well as XMLSchema datatypes.
In order to specify a specific range for the property follow the steps below.
- Click on the Add Classes button
next to Allowed classes
- Most of the XML Datatypes are available should you desire to use them.
Click on the knob next to XMLSchema:anyType to see the list expanded

- Otherwise you can select daml_oil:Thing or any of its subclasses
- Domains are not specified on the Slots tab, instead go over to the Classes
tab.
- Select the class that you mean to be the domain of the slot.
- You need to put the slot into the damlProperties field of the class.

- To add a previously created Slot press the add button
and choose the slot from the
window that pops up.

- To create a new slot for this class, press the create button

- You do not have to specify a domain for any slot, however you might want
to use the slot in several places without specifying the domain. In this
case the best thing to do is to add the slot to daml_oil:Thing. If the slot appears in the damlProperties field of daml_oil:Thing it will
be available to all your classes.
- Protege supports subslots which we will use to map to
subproperties.
- To create a new subslot go to the Slots tab
- Right click on the Slot you wish to use as the superslot, and select
create subslot

- Note: Protege subslots are not fully implemented yet. One thing that
you should know is that subslots only inherit things from their parents at
creation time. So if you should update the superslot, the subslot will
not change unless you do it manually. This should be fixed in the next
version of Protege.
Properties that have been created using the steps described under New
Properties, will be serialized into daml_oil:Property.
- You can create Object or Datatype Properties by changing the metaclass of
the Slot
- Right click on the slot that you want to change and then select "Change
slot metaclass..."

- Then you can select ObjectProperty DatatypeProperty.

- You can change the property's type using the three checkboxes, and you can
add or create other slots to fill the roles of EquivalentTo, SamePropertyAs,
and InverseOf, if you so desire.

Important things to remember:
- TransitiveProperty and Unambiguous Property are subclasses of
ObjectProperty
- If a TransitiveProperty is used in a cardinality constraint, class
consistency may no longer be decidable
To create view or edit instance click on the Instances tab
First select the class of which you would like to create an instance

Then click the
button above the
Direct Instances field.

You now have an instance of a class.
You should rename it, since any instance that begins with "KB_" will not get
an rdf:ID upon serialization. If you do not rename it, you may lose your
work upon serialization. Rename your instance by editing the ":NAME"
field.

You can add values to the slots of an instance by clicking on the create
, or add
buttons on the respective field.
(Note: If your property is not showing up in your instance, then you have
not specified its domain properly. Remember properties with no specified
domain should be added to the daml_oil:Thing as mentioned above.) When you
press
you are creating a new instance
of the type that is specified by the range of the property. When you press
you are adding an existing
instance of that type.
Important notes regarding XML
When you create instances of XML types, they are actual
instances of that type. For example, the property MyPropertyB has the
range XMLSchema:integer. Supposing that I want to add the value 42 to my
instance. I press the
button
(unless I alredy have an instance of 42) and select the correct type.

Then I enter the value that I desire into the :NAME slot
of the new instance that appears on the screen.

Now the value will appear in the field for the property.

If I had already created the XMLSchema:integer value of 42
previous to this time, I would not be able to create another instance of it
(There is only one 42 in the universe and for everything that has the value 42,
it is the same 42).
Instead I would add the value to my property field using
the
button.

It will be a Direct Instance of XMLSchema:integer, so I
can select it from this dialog.
IMPORTANT: Do not edit the
value of the instance of an XML datatype!
Do not view and change the value of 42. These slots
are filled with references to instances. Since this is a reference to the
actual instance of 42, changing its value has the same effect as changing the
value of 42 everywhere in the ontology. If one were to view and change 42,
to 43, the value of 42 is actually changed to 43, and all references to
42 will continue to point to the same instance which now has the value of 43.
Instead of doing that, remove the value from the property
using the
button, and create a
NEW instance of an integer to take it's place. Removing the instance
does not delete it. It only removes it from the slot. It can still
be referenced elsewhere in the ontology, and those slots will remain unchanged.
Restrictions are created from the Classes tab. In the DAML+OIL plug-in there is a field
in each class for Restrictions. In that field you can specify a Restriction, and on
serialization the Class will be a subclass of all the Restrictions
listed there.
- You create a new Restriction by pressing the Create button
of the Restriction field
- Then select the type of restriction you would like to create. (See
Qualified Restriction below for the other
kinds of Restrictions)

- You'll then get a window that looks like this

- Select a slot that you would like to put this restriction on by pressing
the add
or create
buttons next to onProperty
- Then enter a value for the restriction
- If the restriction is a cardinality restriction, then you'll be able to
put a number in the value slot
- Otherwise you'll be able to select the appropriate type of object by using
the add
or create
buttons.
- When you close the Restriction's window it should show up in the
Restriction field of the class.

- The Restrictions cardinalityQ, minCardinalityQ, and
maxCardinalityQ were unavailable to you in the Restrictions field, but you
can enter them in the Qualified Restrictions field. The only difference
is that this time you must enter a hasClassQ value.

- In the Class window you should get something like this

The boolean combinations unionOf, intersectionOf, and complementOf,
and further class elements such as disjointUnionOf, oneOf,
and disjointWith, can be added to a class from the
Logical Definition field in a similar manner to the way Restrictions worked.
- Press the create button

- Select the type

- You'll get a window that looks like this:

- Press the add button
to add
one or more classes or the create button
to
create a class on the fly.
- First you'll have to select the type of class that you are trying to add
- Note all user-defined classes that are not Restrictions are under "Class"

- You should end up with something like this

As you have probably guessed SameClassAs and EquivalentTo map to their
respective DAML+OIL tags. You can add or create classes for those slots using
the buttons above the fields.
The daml:Ontology can be accessed from the Ontology Class under the Classes
tab
