Classifier (as specialized)

Description

A classifier can specify a generalization hierarchy by referencing its general classifiers.

Attributes

Associations

Constraints

  1. Generalization hierarchies must be directed and acyclical. A classifier can not be both a transitively general and transitively specific classifier of the same classifier.

    not self.allParents()->includes(self)

  2. A classifier may only specialize classifiers of a valid type.

    self.parents()->forAll(c | self.maySpecializeType(c))

  3. The inheritedMember association is derived by inheriting the inheritable members of the parents.

    self.inheritedMember->includesAll(self.inherit(self.parents()->collect(p | p.inheritableMembers(self)))

Additional Operations

  1. The query parents() gives all of the immediate ancestors of a generalized Classifier.

    Classifier::parents(): Set(Classifier);

    parents = general

  2. The query allParents() gives all of the direct and indirect ancestors of a generalized Classifier.

    Classifier::allParents(): Set(Classifier);

    allParents = self.parents()->union(self.parents()->collect(p | p.allParents())

  3. The query inheritableMembers() gives all of the members of a classifier that may be inherited in one of its descendants, subject to whatever visibility restrictions apply.

    Classifier::inheritableMembers(c: Classifier): Set(NamedElement);

    pre: c.allParents()->includes(self)

    inheritableMembers = member->select(m | c.hasVisibilityOf(m))

  4. The query hasVisibilityOf() determines whether a named element is visible in the classifier. By default all are visible. It is only called when the argument is something owned by a parent.

    Classifier::hasVisibilityOf(n: NamedElement) : Boolean;

    pre: self.allParents()->collect(c | c.member)->includes(n)

    hasVisibilityOf =true

  5. The query inherit() defines how to inherit a set of elements. Here the operation is defined to inherit them all. It is intended to be redefined in circumstances where inheritance is affected by redefinition.

    Classifier::inherit(inhs: Set(NamedElement)): Set(NamedElement);

    inherit = inhs

  6. The query maySpecializeType() determines whether this classifier may have a generalization relationship to classifiers of the specified type. By default a classifier may specialize classifiers of the same or a more general type. It is intended to be redefined by classifiers that have different specialization constraints.

    Classifier::maySpecializeType(c : Classifier) : Boolean;

    maySpecializeType = self.oclIsKindOf(c.oclType)

Semantics

The specific semantics of how generalization affects each concrete subtype of Classifier varies.

An instance of a specific Classifier is also an (indirect) instance of each of the general Classifiers. 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.

Notation

The name of an abstract Classifier is shown in italics.

Generalization is shown as a line with an 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 "separate target style". See the example section below.

Presentation Options

Multiple Classifiers that have the same general classifier can be shown together in the "shared target style". See the >example section below.

An abstract Classifier can be shown using the keyword {abstract} after or below the name of the Classifier.

Examples