Difference between revisions of "PrF UG slots override slot"
(6 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 |
− | + | in the [[PrF_UG_classes_classes_tab|Classes tab]] | |
− | + | of the [[PrF_UG_classes_class_window|Class Browser]]. | |
</p> | </p> | ||
Line 39: | 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 | at the upper right | ||
Line 46: | Line 46: | ||
<li><p> | <li><p> | ||
− | + | Double-click the slot and select <b>View slot at class</b> | |
in the <b>Select Slot View</b> dialog box, | 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| | + | <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 |
− | + | in the [[PrF_UG_slots_slot_editor|Slot Editor]]. | |
− | See | + | See [[PrF_UG_slots_editing_slot_properties|Editing Slot Properties]] |
− | |||
for more information. | for more information. | ||
</p> | </p> | ||
Line 64: | 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 | ||
− | [[Image:PrF_UG_slots_slot.overridden.gif|slots_slot.overridden]] icon. | + | ([[Image:PrF_UG_slots_slot.overridden.gif|slots_slot.overridden]]) icon. |
=== Scope === | === Scope === | ||
Line 84: | Line 84: | ||
<ul class='a'> | <ul class='a'> | ||
<li><p> | <li><p> | ||
− | at the | + | at the [[PrF_UG_slots_slots_tab|Slots tab]] |
− | |||
</p> | </p> | ||
Line 101: | 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. |
− | + | 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, |
− | |||
− | |||
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 |
− | + | 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 117: | 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. |
− | |||
</p> | </p> | ||
</ol> | </ol> | ||
Line 128: | 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 146: | Line 143: | ||
<li><p> | <li><p> | ||
− | For certain value types, | + | For certain value types, some restrictions apply: |
− | |||
</p> | </p> | ||
Line 153: | 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>Boolean</b>, <b>Class</b>, <b>Float</b>, <b>Instance</b>, | |
− | + | <b>Integer</b>, <b>String</b>, or <b>Symbol</b>). | |
− | |||
− | <b>Integer</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 165: | 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 187: | 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
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 () 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:
Select a class in the Classes tab of the Class Browser.
Select the slot you wish to edit in the Template Slots pane.
Open the Slot Editor in one of the following ways:
Click the View Slot 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.
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 () 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
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.
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.