language-lawyeruml

UML and ownership of GeneralizationSet


The UML 2.5.1 specification, available for free download on the OMG website, does not specifically state what the ideal owner Element of a GeneralizationSet should be. We have the following options:

  1. Since GeneralizationSet is a PackageableElement, we can assign ownership to a Package. This would most likely be the nearest enclosing Namespace for all of the Generalizations it contains (or at least for the 'general' Classifier which must be the same for all of the Generalizations in its set), but there is no guidance for this in the UML spec;

  2. Since all Generalizations in a GeneralizationSet must have the same 'general' Classifier, this could be the designated owner of the GeneralizationSet itself;

  3. There can be an associated powertype, but since there might not be any (multiplicity is [0..1]), and GeneralizationSet must have an owner, this won't work;

  4. Something else?

I am inclined to select option 2, but not sure if this has any unforeseen implications?


Solution

  • Option 2 and 3 are not possible, since classes can't own GeneralizationSets. I think option 1 is the way to go.

    GeneralizationSets can exist without Generalizations. Therefore, it would be possible to first define a set and later find the Generalizations for it. I can imagine a method that makes use of this.

    So, there is really no best place for them. It is up to the modeler. Putting them somewhere near their Generalizations is probably a good idea.