Difference between revisions of "PrF UG classes replace superclass"

From Protege Wiki
Jump to: navigation, search
Line 5: Line 5:
  
 
You can move a class to a different superclass,
 
You can move a class to a different superclass,
using drag-and-drop in the
+
using drag-and-drop
[[PrF_UG_classes_class_browser|Class Browser]].
+
in the [[PrF_UG_classes_class_browser|Class Browser]].
This will remove the class from one superclass and make it a subclass of another superclass.
+
This will remove the class from one superclass
 +
and make it a subclass of another superclass.
 
Note that when you replace the superclass of a class,
 
Note that when you replace the superclass of a class,
 
the class will often lose and gain inherited slots.
 
the class will often lose and gain inherited slots.
Line 19: Line 20:
 
     Select the class you want to move.
 
     Select the class you want to move.
 
     If the class has more than one superclass,
 
     If the class has more than one superclass,
     select the view of the class that appears under the superclass you want to replace.
+
     select the view of the class that appears
 +
    under the superclass you want to replace.
 
     </p>
 
     </p>
  
 
   <li><p>
 
   <li><p>
     Hold down the mouse button and drag the class on top of the new superclass.
+
     Hold down the mouse button
 +
    and drag the class on top of the new superclass.
 
     </p>
 
     </p>
  
Line 30: Line 33:
 
     The subclass will no longer be under the original superclass,
 
     The subclass will no longer be under the original superclass,
 
     but will now be located under the new superclass.
 
     but will now be located under the new superclass.
     Note that the slots of the moved class will automatically change to reflect the inheritance from its new superclass.
+
     Note that the slots of the moved class will automatically change
 +
    to reflect the inheritance from its new superclass.
 
     </p>
 
     </p>
 
</ol>
 
</ol>
  
You can also
+
You can also [[PrF_UG_classes_add_superclass|add a superclass]]
[[PrF_UG_classes_add_superclass|add a superclass]]
+
by holding down the <b>Ctrl</b> (<b>Cmd</b>) key while you drag.
by holding down the <b>Ctrl</b>
 
(<b>Cmd</b>)
 
key while you drag.
 
  
 
=== Example ===
 
=== Example ===
Line 50: Line 51:
 
     [[PrF_UG_classes_class_browser|Class Browser]].
 
     [[PrF_UG_classes_class_browser|Class Browser]].
 
     Because <b>Columnist</b> has more than one superclass,
 
     Because <b>Columnist</b> has more than one superclass,
     you must make sure to select the copy of <b>Columnist</b> that is under <b>Employee</b>. (When a class has more than one superclass,
+
     you must make sure to select the copy of <b>Columnist</b>
 +
    that is under <b>Employee</b>.
 +
    (When a class has more than one superclass,
 
     you can use the <b>Superclasses</b> pane to select the copy that you want.
 
     you can use the <b>Superclasses</b> pane to select the copy that you want.
     See
+
     See [[PrF_UG_classes_jump_to_superclass|Jumping to a Different Superclass]]
    [[PrF_UG_classes_jump_to_superclass|Jumping to a Different Superclass]]
+
     for more information.)
     for more information.) Note that the
+
    Note that the [[PrF_UG_classes_template_slot_pane|Template Slots Pane]]
    [[PrF_UG_classes_template_slot_pane|Template Slots Pane]]
 
 
     for <b>Columnist</b> includes slots it inherits from <b>Employee</b>.
 
     for <b>Columnist</b> includes slots it inherits from <b>Employee</b>.
   
 
    </p><p> <div>[[Image:PrF_UG_classes_superclass_drag_1.png|classes_superclass_drag_1]]</div>
 
 
     </p>
 
     </p>
 +
    <div>[[Image:PrF_UG_classes_superclass_drag_1.png|classes_superclass_drag_1]]</div>
  
 
   <li><p>
 
   <li><p>
     Hold down the mouse button and drag <b>Columnist</b> on top of the new superclass <b>Person</b>.
+
     Hold down the mouse button and drag <b>Columnist</b>
 +
    on top of the new superclass <b>Person</b>.
 
     </p>
 
     </p>
  
 
   <li><p>
 
   <li><p>
 
     Release the mouse button to drop the class.
 
     Release the mouse button to drop the class.
     <b>Person</b> is outlined and the
+
     <b>Person</b> is outlined
    [[PrF_UG_classes_class_browser|Class Browser]]
+
    and the [[PrF_UG_classes_class_browser|Class Browser]]
 
     redisplays to show the new hierarchy.
 
     redisplays to show the new hierarchy.
     The dragged class and all of its subclasses,
+
     The dragged class and all of its subclasses, if any,
    if any,
 
 
     will be moved from the original superclass to the new superclass.
 
     will be moved from the original superclass to the new superclass.
    </p><p> <div>[[Image:PrF_UG_classes_superclass_drag_2.png|classes_superclass_drag_2]]</div>
 
 
     </p>
 
     </p>
 +
    <div>[[Image:PrF_UG_classes_superclass_drag_2.png|classes_superclass_drag_2]]</div>
 
</ol>
 
</ol>
  

Revision as of 12:26, October 15, 2008

Replacing a Superclass


Protege-Frames User's Guide
Classes
Classes Tab
Class Browser
Class Buttons
Class Hierarchy Window
Class Icons
Class Menu
Class Search Bar
Superclasses Pane
Class Editor
Constraints
Template Slots Pane
Template Slot Buttons
References Window
Creating a New Class
Creating Multiple Subclasses
Deleting a Class
Displaying the Class Editor
Editing a Class
Editing Template Slots
Finding a Class
Hiding a Class
Replacing a Superclass
Adding a Superclass
Jumping to A Superclass
Removing a Superclass
Viewing Class Relations
Classes & Instances Tab
Viewing References
Glossary, Editing Help

You can move a class to a different superclass, using drag-and-drop in the Class Browser. This will remove the class from one superclass and make it a subclass of another superclass. Note that when you replace the superclass of a class, the class will often lose and gain inherited slots.

Moving a Class

To move a class:

  1. Select the class you want to move. If the class has more than one superclass, select the view of the class that appears under the superclass you want to replace.

  2. Hold down the mouse button and drag the class on top of the new superclass.

  3. Release the mouse. The subclass will no longer be under the original superclass, but will now be located under the new superclass. Note that the slots of the moved class will automatically change to reflect the inheritance from its new superclass.

You can also add a superclass by holding down the Ctrl (Cmd) key while you drag.

Example

The following example shows how to make Columnist inherit from Employee, rather than the class Person.

  1. Highlight Columnist in the Class Browser. Because Columnist has more than one superclass, you must make sure to select the copy of Columnist that is under Employee. (When a class has more than one superclass, you can use the Superclasses pane to select the copy that you want. See Jumping to a Different Superclass for more information.) Note that the Template Slots Pane for Columnist includes slots it inherits from Employee.

    classes_superclass_drag_1
  2. Hold down the mouse button and drag Columnist on top of the new superclass Person.

  3. Release the mouse button to drop the class. Person is outlined and the Class Browser redisplays to show the new hierarchy. The dragged class and all of its subclasses, if any, will be moved from the original superclass to the new superclass.

    classes_superclass_drag_2

If you highlight Columnist after it has been repositioned, you will see that some of the slots it had before are now missing. These were the slots it inherited from Employee.

classes_superclass_drag_3