Difference between revisions of "PrF UG slots override slot"

From Protege Wiki
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
== Overriding Slot Properties at a Class ==
 
== Overriding Slot Properties at a Class ==
  
{{PrF_UG_TOC_slots}}<div id='prf_ug'>
+
<noinclude>{{PrF_UG_TOC_slots}}<div id='prf_ug'></noinclude>
  
 
You can override slot properties by editing the slot at the class level.
 
You can override slot properties by editing the slot at the class level.
 
This allows you to be more restrictive about the slot facets relative to that class.
 
This allows you to be more restrictive about the slot facets relative to that class.
 
A slot with overrides is shown with an override
 
A slot with overrides is shown with an override
[[Image:PrF_UG_slots_slot.overridden.gif|slots_slot.overridden]] icon
+
([[Image:PrF_UG_slots_slot.overridden.gif|slots_slot.overridden]]) icon
 
in the [[PrF_UG_classes_template_slot_pane|Template Slots pane]].
 
in the [[PrF_UG_classes_template_slot_pane|Template Slots pane]].
  
Line 21: Line 21:
 
<ol class='a'>
 
<ol class='a'>
 
   <li><p>
 
   <li><p>
     Select a class in the
+
     Select a class
    [[PrF_UG_classes_class_window|Class Browser]]
+
    in the [[PrF_UG_classes_classes_tab|Classes tab]]
     in the
+
     of the [[PrF_UG_classes_class_window|Class Browser]].
    [[PrF_UG_classes_classes_tab|Classes tab]].
 
 
     </p>
 
     </p>
  
 
   <li><p>
 
   <li><p>
     Select the slot you wish to edit in the
+
     Select the slot you wish to edit
    [[PrF_UG_classes_template_slot_pane|Template Slots pane]].
+
    in the [[PrF_UG_classes_template_slot_pane|Template Slots pane]].
 
     </p>
 
     </p>
  
 
   <li><p>
 
   <li><p>
     Open the
+
     Open the [[PrF_UG_slots_slot_editor|Slot Editor]]
    [[PrF_UG_slots_slot_editor|Slot Editor]]
 
 
     in one of the following ways:
 
     in one of the following ways:
 
     </p>
 
     </p>
Line 41: Line 39:
 
     <li><p>
 
     <li><p>
 
       Click the <b>View Slot Overrides</b>
 
       Click the <b>View Slot Overrides</b>
       [[Image:PrF_UG_slots_slot.view_overrides.gif|slots_slot.view_overrides]]
+
       ([[Image:PrF_UG_slots_slot.view_overrides.gif|slots_slot.view_overrides]])
 
       [[PrF_UG_classes_template_slot_buttons|Slot button]]
 
       [[PrF_UG_classes_template_slot_buttons|Slot button]]
       at the upper right of the
+
       at the upper right
      [[PrF_UG_classes_template_slot_pane|Template Slots pane]].
+
      of the [[PrF_UG_classes_template_slot_pane|Template Slots pane]].
 
       </p>
 
       </p>
 
    
 
    
 
     <li><p>
 
     <li><p>
       <i>or</i> Double-click the slot and select <b>View slot at class</b> in the <b>Select Slot View</b> dialog box,
+
       Double-click the slot and select <b>View slot at class</b>
 +
      in the <b>Select Slot View</b> dialog box,
 
       then click <b>OK</b>.
 
       then click <b>OK</b>.
      </p><p> <div>[[Image:PrF_UG_slots_slot_at_class.png|slots_slot_at_class]]</div>
 
 
       </p>
 
       </p>
 +
      <div>[[Image:PrF_UG_slots_slot_at_class.png|frame|none|
 +
            Select Slot View dialog]]</div>
 
   </ul>
 
   </ul>
  
 
   <li><p>
 
   <li><p>
     Change the desired properties in the
+
     Change the desired properties
    [[PrF_UG_slots_slot_editor|Slot Editor]].
+
    in the [[PrF_UG_slots_slot_editor|Slot Editor]].
     See
+
     See [[PrF_UG_slots_editing_slot_properties|Editing Slot Properties]]
    [[PrF_UG_slots_editing_slot_properties|Editing Slot Properties]]
 
 
     for more information.
 
     for more information.
 
     </p>
 
     </p>
Line 65: Line 64:
 
After you have edited a slot at the class level,
 
After you have edited a slot at the class level,
 
the slot will be displayed with an override
 
the slot will be displayed with an override
<div>[[Image:PrF_UG_slots_slot.overridden.gif|slots_slot.overridden]]</div>
+
([[Image:PrF_UG_slots_slot.overridden.gif|slots_slot.overridden]]) icon.
icon.
 
  
 
=== Scope ===
 
=== Scope ===
Line 86: Line 84:
 
<ul class='a'>
 
<ul class='a'>
 
   <li><p>
 
   <li><p>
     at the
+
     at the [[PrF_UG_slots_slots_tab|Slots tab]]
    [[PrF_UG_slots_slots_tab|Slots Tab]]
 
 
     </p>
 
     </p>
  
Line 103: Line 100:
 
<ol class='a'>
 
<ol class='a'>
 
   <li><p>
 
   <li><p>
     The slot <b>employee_list</b> is a slot of type <b>Instance</b> that takes the value <b>Employee</b> at the top level.
+
     The slot <b>employee_list</b> is a slot of type <b>Instance</b>
     By default,
+
    that takes the value <b>Employee</b> at the top level.
    whenever you attach this slot to a class,
+
     By default, whenever you attach this slot to a class,
 
     it will range over the instances of <b>Employee</b>.
 
     it will range over the instances of <b>Employee</b>.
     Suppose,
+
     Suppose, however, that for this class,
    however,
 
    that for this class,
 
 
     you want to restrict the possible employees to salespeople.
 
     you want to restrict the possible employees to salespeople.
     By overriding the slot,
+
     By overriding the slot, you can restrict the value range
    you can restrict the value range to the <b>Salesperson</b> subclass of <b>Employee</b> for the current class and its subclasses,
+
    to the <b>Salesperson</b> subclass of <b>Employee</b>
 +
    for the current class and its subclasses,
 
     without affecting the slot value range for any other class.
 
     without affecting the slot value range for any other class.
 
     </p>
 
     </p>
Line 119: Line 115:
 
     Suppose you had a class of articles which appeared only on work days,
 
     Suppose you had a class of articles which appeared only on work days,
 
     not Saturday or Sunday.
 
     not Saturday or Sunday.
     You could override the slot <i>weekday</i> at that class to remove <i>Saturday</i> and <i>Sunday</i> from the <b>Symbol</b> list for that class only,
+
     You could override the slot <i>weekday</i> at that class
 +
    to remove <i>Saturday</i> and <i>Sunday</i> from the <b>Symbol</b> list for that class only,
 
     restricting the possibilities to working days.
 
     restricting the possibilities to working days.
     Once again,
+
     Once again, the top-level slot and its range at other classes will remain unchanged.
    the top-level slot and its range at other classes will remain unchanged.
 
 
     </p>
 
     </p>
 
</ol>
 
</ol>
Line 130: Line 126:
 
When you override a slot at a class,
 
When you override a slot at a class,
 
you can edit slot facets in the same way as you can at the top level.
 
you can edit slot facets in the same way as you can at the top level.
The override will not remove any existing restrictions,
+
The override will not remove any existing restrictions, however,
however,
 
 
and may in fact tighten one or more of them:
 
and may in fact tighten one or more of them:
  
Line 148: Line 143:
  
 
   <li><p>
 
   <li><p>
     For certain value types,
+
     For certain value types, some restrictions apply:
    some restrictions apply:
 
 
     </p>
 
     </p>
  
Line 155: Line 149:
 
     <li><p>
 
     <li><p>
 
       For a slot of type <b>Any</b>,
 
       For a slot of type <b>Any</b>,
       the slot may be restricted to <i>one</i> of the other types (<b>Boolean</b>,
+
       the slot may be restricted to <i>one</i> of the other types
      <b>Class</b>,
+
      (<b>Boolean</b>, <b>Class</b>, <b>Float</b>, <b>Instance</b>,
      <b>Float</b>,
+
       <b>Integer</b>, <b>String</b>, or <b>Symbol</b>).
      <b>Instance</b>,
 
       <b>Integer</b>,
 
      <b>String</b>,
 
      or <b>Symbol</b>).
 
 
       You cannot change the type of slots other than type <b>Any</b>.
 
       You cannot change the type of slots other than type <b>Any</b>.
 
       </p>
 
       </p>
Line 167: Line 157:
 
     <li><p>
 
     <li><p>
 
       For a slot of type <b>Class</b>,
 
       For a slot of type <b>Class</b>,
       the allowed superclasses can only be changed to subclasses of the allowed superclasses in the superclass.
+
       the allowed superclasses can only be changed to subclasses
 +
      of the allowed superclasses in the superclass.
 
       </p>
 
       </p>
 
    
 
    
 
     <li><p>
 
     <li><p>
 
       For a slot of type <b>Instance</b>,
 
       For a slot of type <b>Instance</b>,
       the allowed classes can only be changed to subclasses of the allowed classes in the superclass.
+
       the allowed classes can only be changed to subclasses
 +
      of the allowed classes in the superclass.
 
       </p>
 
       </p>
 
   </ul>
 
   </ul>
  
 
   <li><p>
 
   <li><p>
     A <b>Minimum</b> value (on types <b>Integer</b> or <b>Float</b>) may be created or <i>increased</i>.
+
     A <b>Minimum</b> value (on types <b>Integer</b> or <b>Float</b>)
 +
    may be created or <i>increased</i>.
 
     </p>
 
     </p>
  
 
   <li><p>
 
   <li><p>
     A <b>Maximum</b> value (on types <b>Integer</b> or <b>Float</b>) may be created or <i>decreased</i>.
+
     A <b>Maximum</b> value (on types <b>Integer</b> or <b>Float</b>)
 +
    may be created or <i>decreased</i>.
 
     </p>
 
     </p>
  
Line 189: Line 183:
 
</ul>
 
</ul>
  
<b>Note:</b> Currently,
+
<b>Note:</b>
when you override a slot, {{#var:PrF}} does not enforce the restrictive property.
+
Currently, when you override a slot,
That is,
+
{{#var:PrF}} does not enforce the restrictive property.
you could theoretically expand or change the facets of a slot,
+
That is, you could theoretically expand or change the facets of a slot,
 
rather than restricting them.
 
rather than restricting them.
However,
+
However, it is <i>not</i> recommended that you do this,
it is <i>not</i> recommended that you do this,
+
both because it is not good practice
both because it is not good practice and because {{#var:PrF}} may enforce restriction in the future.
+
and because {{#var:PrF}} may enforce restriction in the future.
  
</div>
+
 
 +
<noinclude></div></noinclude>

Latest revision as of 18:49, November 13, 2008

Overriding Slot Properties at a Class


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

You can override slot properties by editing the slot at the class level. This allows you to be more restrictive about the slot facets relative to that class. A slot with overrides is shown with an override (slots_slot.overridden) icon in the Template Slots pane.

You can also edit the properties of a slot directly, instead of just overriding them at a class. See Editing a Top-level Slot for more information.

Overriding a Slot

To edit the slot properties for a specific class:

  1. Select a class in the Classes tab of the Class Browser.

  2. Select the slot you wish to edit in the Template Slots pane.

  3. Open the Slot Editor in one of the following ways:

    • Click the View Slot Overrides (slots_slot.view_overrides) Slot button at the upper right of the Template Slots pane.

    • Double-click the slot and select View slot at class in the Select Slot View dialog box, then click OK.

      Select Slot View dialog
  4. Change the desired properties in the Slot Editor. See Editing Slot Properties for more information.

After you have edited a slot at the class level, the slot will be displayed with an override (slots_slot.overridden) icon.

Scope

Overrides appear:

  • at the selected class

  • at all of its subclasses

Overrides do not appear:

  • at the Slots tab

  • at any superclasses

  • at any unrelated classes

Examples

  1. The slot employee_list is a slot of type Instance that takes the value Employee at the top level. By default, whenever you attach this slot to a class, it will range over the instances of Employee. Suppose, however, that for this class, you want to restrict the possible employees to salespeople. By overriding the slot, you can restrict the value range to the Salesperson subclass of Employee for the current class and its subclasses, without affecting the slot value range for any other class.

  2. Suppose you had a class of articles which appeared only on work days, not Saturday or Sunday. You could override the slot weekday at that class to remove Saturday and Sunday from the Symbol list for that class only, restricting the possibilities to working days. Once again, the top-level slot and its range at other classes will remain unchanged.

Restrictions

When you override a slot at a class, you can edit slot facets in the same way as you can at the top level. The override will not remove any existing restrictions, however, and may in fact tighten one or more of them:

  • The Name of an inherited slot cannot be changed.

  • For Cardinality, the slot may be changed from Multiple to Single, but not vice versa. The at least value may be increased; the at most value may be decreased.

  • For certain value types, some restrictions apply:

    • For a slot of type Any, the slot may be restricted to one of the other types (Boolean, Class, Float, Instance, Integer, String, or Symbol). You cannot change the type of slots other than type Any.

    • For a slot of type Class, the allowed superclasses can only be changed to subclasses of the allowed superclasses in the superclass.

    • For a slot of type Instance, the allowed classes can only be changed to subclasses of the allowed classes in the superclass.

  • A Minimum value (on types Integer or Float) may be created or increased.

  • A Maximum value (on types Integer or Float) may be created or decreased.

  • Default values cannot be removed.

Note: Currently, when you override a slot, Protege-Frames does not enforce the restrictive property. That is, you could theoretically expand or change the facets of a slot, rather than restricting them. However, it is not recommended that you do this, both because it is not good practice and because Protege-Frames may enforce restriction in the future.