Inserting a Generalization or a Dependency Relationship
Generalizations and dependencies express various types of relationships between classes and in doing so describe the structure classes. The generalization expresses the fact that a class represents a generalization of another class. The dependency relationship expresses the fact that one or more classes depend, either structurally or semantically, on the definition of another class.
Prerequisites
At least one relationship template for generalizations needs to exist in the model to be able to create a generalization relationship.
Context
Classes can inherit from each other. Here, the subclass receives the entire behavior of the super class and can, moreover, contain other attributes or operations as well. Please note that relationships can also be inherited as well as the behavior.
Note
A generalization relationship is always created from the specific source element to the general target element from which the behavior and relationships are inherited.
However, it is possible to select generalizations in the diagram and reverse them with the Revert Direction context menu command and make them into the source element's specialization relationship.
How to proceed
-
In the diagram, select the classes for which you want to create a transmission relationship.
The carousel appears.
-
Move the mouse pointer over the
Generalization connection type in the carousel.
-
Drag the link with the mouse button pressed to the existing target element and release the mouse button to create a generalization relationship to an existing class.
You have created a generalization relationship between the special class (source) and the general class (target).
-
If you want to create a generalization relationship to a new class instead, drag the link with the mouse button pressed to the free target position and release the mouse button.
The Create Connection dialog appears.
-
Select the class.
A general class and the generalization relationship to the special source element are inserted in the diagram. The class is integrated into the model structure. A unique name is created and selected.
-
Enter the name of the class and then press the [Enter] key.
The class is renamed. An error message appears if the name entered is not unique.
-
If you reverse the generalization relationship and want to change it into a specialization relationship, then select the generalization relationship and select Revert Direction in the context menu.
The direction of the generalization relationship is reversed.
Dependency relationships are created in the same way as generalizations (apart from point 7), by using one of the arrow icons (,
,
etc.) in the carousel. You can find out how the dependency relationships differ from each other in the tool tip for the respective arrow icon.