Previous UML Classes Table of Contents UML Packages Next


7.3.20 Generalization

Kernel , PowerTypes


   A generalization is a taxonomic relationship between a more general classifier and a more specific classifier. Each instance of the specific classifier is also an indirect instance of the general classifier. Thus, the specific classifier inherits the features of the more general classifier.

*Generalizations

   

    DirectedRelationship (from Kernel ) on page 62

*Description

   A generalization relates a specific classifier to a more general classifier, and is owned by the specific classifier.

   Package PowerTypes

   A generalization can be designated as being a member of a particular generalization set.

*Attributes

*Associations

   DirectedRelationship ::target

   • specific: Classifier [1] References the specializing classifier in the Generalization relationship. Subsets DirectedRelationship ::source and Element::owner

   Package PowerTypes

   • generalizationSet Designates a set in which instances of Generalization are considered members.

*Constraints

   No additional constraints

   Package PowerTypes

   [1] Every Generalization associated with a given GeneralizationSet must have the same general Classifier. That is, all Generalizations for a particular GeneralizationSet must have the same superclass.

*Semantics

   Where a generalization relates a specific classifier to a general classifier, each instance of the specific classifier is also an instance of the general classifier. Therefore, features specified for instances of the general classifier are implicitly specified for instances of the specific classifier. Any constraint applying to instances of the general classifier also applies to instances of the specific classifier.

   Package PowerTypes

   Each Generalization is a binary relationship that relates a specific Classifier to a more general Classifier (i.e., a subclass). Each GeneralizationSet contains a particular set of Generalization relationships that collectively describe the way in which a specific Classifier (or class) may be divided into subclasses. The generalizationSet associates those instances of a Generalization with a particular GeneralizationSet .

   For example, one Generalization could relate Person as a general Classifier with a Female Person as the specific Classifier. Another Generalization could also relate Person as a general Classifier, but have Male Person as the specific Classifier. These two Generalizations could be associated with the same GeneralizationSet , because they specify one way of partitioning the Person class.

*Notation

   A Generalization is shown as a line with a hollow triangle as an arrowhead between the symbols representing the involved classifiers. The arrowhead points to the symbol representing the general classifier. This notation is referred to as the separate target style. See the example section below.

   Package PowerTypes

   A generalization is shown as a line with a hollow triangle as an arrowhead between the symbols representing the involved classifiers. The arrowhead points to the symbol representing the general classifier. When these relationships are named, that name designates the GeneralizationSet to which the Generalization belongs. Each GeneralizationSet has a name (which it inherits since it is a subclass of PackageableElement ). Therefore, all Generalization relationships with the same GeneralizationSet name are part of the same GeneralizationSet . This notation form is depicted in a), Figure 7.42.

    When two or more lines are drawn to the same arrowhead, as illustrated in b), Figure 7.42, the specific Classifiers are part of the same GeneralizationSet . When diagrammed in this way, the lines do not need to be labeled separately; instead the generalization set need only be labeled once. The labels are optional because the GeneralizationSet is clearly designated.

    Lastly in c), Figure 7.42, a GeneralizationSet can be designated by drawing a dashed line across those lines with separate arrowheads that are meant to be part of the same set, as illustrated at the bottom of Figure 7.42. Here, as with b), the GeneralizationSet may be labeled with a single name, instead of each line labeled separately. However, such labels are optional because the GeneralizationSet is clearly designated.

   another one Generalization Set Generalization Set

   generalization generalization generalization set name-2

   set name-1 set name-1


   a) GeneralizationSet sharing same general Classifier using the same generalization relationship names.

   onGeneralSe

   tion Set


   b) GeneralizationSet designation by subtypes sharing a common generalization arrowhead.


   c) GeneralizationSet sharing same general Classifier using the dashed-line notation.

   Figure 7.42 - GeneralizationSet designation notations

*Presentation Options

   Multiple Generalization relationships that reference the same general classifier can be connected together in the shared target style. See the example section below.

   Examples

Figure 7.43 - Examples of generalizations between classes

   Package PowerTypes

Issue 8093 -Correct text to match figure.

    In Figure 7.44, the Person class can be specialized as either a Female Person or a Male Person. Furthermore, Person’ s can be specialized as an Employee. Here, Female Person or a Male Person of Person constitute one GeneralizationSet and Employee another. This illustration employs the notation forms depicted in the diagram above.


   Female Person

   employment

   gender

   status


   Male

   Employee

   Person


   Person

   Person

   Person

Figure 7.44 - Multiple subtype partitions (GeneralizationSet s) example