PrF UG classes replace superclass

From Protege Wiki
Jump to: navigation, search

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.

    Class Browser, "Columnist" selected
  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.

    Class Browser, "Person" outlined, "Columnist" selected

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.

Class Browser, "Columnist" selected, some slots missing