PrF UG slots make inverse slot

From Protege Wiki
Jump to: navigation, search

Creating an Inverse Slot Relationship


Protege-Frames User's Guide
Slots
The Slots Tab
The Slot Browser
The Slot Buttons
The Slot Menu
The Slot Editor
The Value Type Menu
The Any Value Type
The Boolean Value Type
The Class Value Type
The Float Value Type
The Instance Value Type
The Integer Value Type
The String Value Type
The Symbol Value Type
Creating a New Slot
Viewing a Slot
Editing a Top-Level Slot
Overriding Slot Properties at a Class
Editing Slot Properties
Removing a Slot from a Class
Deleting a Slot from the Project
Adding a Slot to a Class
Removing Overrides From a Slot
Understanding Inverse Slots
Creating an Inverse Slot Relationship
Working with Subslots
Finding a Slot
The Slot Hierarchy Window
The Slot Icons
The Superslots Pane
Glossary, Editing Help

The Inverse Slots widget on the Slot Editor allows you to create an inverse relationship between two slots of type Class or Instance.

  • You can create an inverse slot relationship in one of two ways: linking two existing slots and creating a new slot as the inverse of an existing slot

  • You can also modify inverse slot relationships, removing the inverse slot link between two slots or replacing an inverse slot with another slot.

For an inverse relationship to work correctly, your two slots and the classes where they appear must be designed appropriately. For slots of type Instance, the following situation provides optimal results:

  • All classes where the first slot is attached (i.e., the domain of the slot) appear in the Allowed Classes pane for the second slot.

  • All classes where the second slot is attached appear in the Allowed Classes pane for the first slot.

However, depending on the structure of your knowledge base, this may not be appropriate or feasible. Other situations are also valid. For example, suppose slots A and B are inverse slots. If one of the allowed classes for slot A does not have B as one of its attached slots, all that happens is that inverse slot value does not get created for those instances. The inverse relationship will still work normally for those allowed classes that do have slot B attached.

A slot can have at most one inverse slot. For more information on designing an inverse slot relationship, see Understanding Inverse Slots.

Note that if you create an inverse slot relationship after instances have been created, existing instances will not display the inverse slot information.

Linking Two Existing Slots

To create an inverse slot relationship between two existing slots, the slots you choose must be of value type Class or Instance. To create the relationship:

  1. Open the Slot Editor for one of the two slots; it does not matter which one you choose. You can open the Slot Editor from the Classes tab or the Slots tab.

  2. Click the Add Slot (slots_slot.add) button at the right of the Inverse Slot field.

    Inverse Slot field

    Note: If the button is grayed out, you cannot create an inverse slot for the selected slot. Make sure that the slot is of type Class or Instance.

  3. Select the slot you want to use from the Select Slot dialog box. Only slots of type Class or Instance will appear.

    Select Slot dialog
  4. Click OK. The two slots will now be inverses of each other.

You can view the Slot Editor of the second slot by double-clicking on its name in the Inverse Slot field or by using the View Slot (slots_slot.view_top_level) button. You will see that it automatically has the first slot as its inverse slot. You may also wish to check that the Allowed Classes of each slot contains all the possible classes where the other slot will appear.

Creating a New Inverse Slot

To create a new slot and make it the inverse of a slot:

  1. Open the Slot Editor for the slot you want to create an inverse for. You can do this from either the Class tab or the Slots tab:

    • On the Slots tab, select the slot from the list of slots in the Slot Browser pane.

    • On the Classes tab, double-click the slot in the list of Template Slots (or select the slot in the list of Template Slots and click the "View Top-Level Slot" button).

  2. Click the Create Slot (slots_slot.create) button at the right of the Inverse Slot Editor.

    Inverse Slot bar

    Note: If the button is grayed out, you cannot create an inverse slot for the selected slot. Make sure it is of type Class or Instance.

  3. A new class of type Instance is created. The Slot Editor for the new slot opens automatically.

    inverse-of-sections dialog
  4. Name the slot.

  5. The classes where your original slot appears will be automatically entered in the Allowed Classes field. Modify this list if necessary.

  6. The classes in the Allowed Classes field of the original slot will be added to the Domain field. Modify this list if necessary. Remember that attaching a slot to a class also attaches it to all subclasses of the class.

  7. Make any other changes you wish to the slot definition.

Removing an Inverse Slot Relationship

Removing the inverse slot relationship removes the link between the two classes. Note that, if you remove an inverse slot relationship after instances have been created, existing values that were created by the inverse slot relationship are not removed. Removing an inverse slot only affects the values of new instances. To remove the inverse slot relationship between two slots:

  1. Highlight the Inverse Slot field in the Slot Editor for either one of the two slots.

  2. Click the Remove (slots_slot.remove) button at the right of the Inverse Slot field. The slot relationship will be removed.

Replacing an Inverse Slot

Replacing the inverse slot relationship at a slot removes the link to the original inverse slot and makes a link with a different, existing, slot. Note that, if you replace an inverse slot relationship after instances have been created, existing values that reflect the original (replaced) inverse slot relationship are retained. Replacing an inverse slot only affects the values of new instance. To replace an inverse relationship:

  1. Select the slot you want to have a different inverse.

  2. Click the Add Slot (slots_slot.add) button at the right of the Inverse Slot field.

  3. Select the slot you want from the Select Slot dialog box.

  4. Click OK. The new slot becomes the inverse slot of the current slot. The original inverse slot is now unlinked from the slot where you made the change and no longer has an inverse slot.