Kernel ­ the Classes Diagram

The Classes diagram of the Kernel package is shown in Figure 30.

In order to locate the metaclasses that are referenced from this diagram:

· See "Classifier (from Kernel, Dependencies, PowerTypes)" on page 61.
· See "Operation (from Kernel)" on page 76.
· See "Relationship (from Kernel)" on page 30.
· See "StructuralFeature (from Kernel)" on page 75.
· See "ValueSpecification (from Kernel)" on page 52.

AggregationKind (from Kernel)

AggregationKind is an enumeration type that specifies the literals for defining the kind of aggregation of a property.

Description

AggregationKind is an enumeration of the following literal values:
Semantic Variation Points

Precise semantics of shared aggregation varies by application area and modeler.
The order and way in which part instances are created is not defined.

Association (from Kernel)

An association describes a set of tuples whose values refers to typed instances. An instance of an association is called a link.

Description

An association specifies a semantic relationship that can occur between typed instances. It has at least two ends represented by properties, each of which is connected to the type of the end. More than one end of the association may have the same type.

When a property is owned by an association it represents a non-navigable end of the association. In this case the property does not appear in the namespace of any of the associated classifiers. When a property at an end of an association is owned by one of the associated classifiers it represents a navigable end of the association. In this case the property is also an attribute of the associated classifier. Only binary associations may have navigable ends.

Attributes

Associations
Constraints

[1] An association specializing another association has the same number of ends as the other association.

self.parents()->forAll(p | p.memberEnd.size() = self.memberEnd.size())

[2] When an association specializes another association, every end of the specific association corresponds to an end of the general association, and the specific end reaches the same type or a subtype of the more general end.

[3] endType is derived from the types of the member ends.

self.endType = self.memberEnd->collect(e | e.type)

Semantics

An association declares that there can be links between instances of the associated types. A link is a tuple with one value for each end of the assocaition, where each value is an instance of the type of the end.

When one or more ends of the association have isUnique=false, it is possible to have several links associating the same set of instances. In such a case, links carry an additional identifier apart from their end values.

When one or more ends of the association are ordered, links carry ordering information in addition to their end values.

For an association with N ends, choose any N-1 ends and associate specific instances with those ends. Then the collection of links of the association that refer to these specific instances will identify a collection of instances at the other end. The multiplicity of the association end constrains the size of this collection. If the end is marked as ordered, this collection will be ordered. If the end is marked as unique, this collection is a set; otherwise it allows duplicate elements.

An end of one association may be marked as a subset of an end of another in circumstances where (a) both have the same number of ends, and (b) each of the set of types connected by the subsetting association conforms to a corresponding type connected by the subsetted association. In this case, given a set of specific instances for the other ends of both associations, the collection denoted by the subsetting end is fully included in the collection denoted by the subsetted end.

An end of one association may be marked as redefining an end of another in circumstances where (a) both have the same number of ends, and (b) each of the set of types connected by the redefing association conforms to a corresponding type connected by the redefined association. In this case, given a set of specific instances for the other ends of both associations, the collections denoted by the redefining and redefined ends are the same.

Associations may be specialized. The existence of a link of a specializing association implies the existence of a link relating the same set of instances in a specialized association.

The semantics of navigable association ends are the same as for attributes.

Note ­ For n-ary associations, the lower multiplicity of an end is typically 0. If the lower multiplicity for an end of an n-ary association of 1 (or more) implies that one link (or more) must exist for every possible combination of values for the other ends.

An association may represent a composite aggregation (i.e., a whole/part relationship). Only binary associations can be aggregations. Composite aggregation is a strong form of aggregation that requires a part instance be included in at most one composite at a time. If a composite is deleted, all of its parts are normally deleted with it. Note that a part can (where allowed) be removed from a composite before the composite is deleted, and thus not be deleted as part of the composite.

Compositions define transitive asymmetric relationships--their links form a directed, acyclic graph. Composition is represented by the isComposite attribute on the part end of the association being set to true.

Semantic Variation Points

The order and way in which part instances in a composite are created is not defined.

The logical relationship between the derivation of an association and the derivation of its ends is not defined.

The interaction of association specialization with association end redefinition and subsetting is not defined.

Notation

Any association may be drawn as a diamond (larger than a terminator on a line) with a solid line for each association end connecting the diamond to the classifier that is the end's type. An association with more than two ends can only be drawn this way.

A binary assocation is normally drawn as a solid line connecting two classifiers, or a solid line connecting a single classifier to itself (the two ends are distinct). A line may consist of one or more connected segments. The individual segments of the line itself have no semantic significance, but they may be graphically meaningful to a tool in dragging or resizing an association symbol.

An association symbol may be adorned as follows:


On a binary association drawn as a solid line, a solid triangular arrowhead next to or in place of the name of the association and pointing along the line in the direction of one end indicates that end to be the last in the order of the ends of the association. The arrow indicates that the association is to be read as associating the end away from the direction of the arrow with the end to which the arrow is pointing (see Figure 31).

An association end is the connection between the line depicting an association and the icon (often a box) depicting the connected classifier. A name string may be placed near the end of the line to show the name of the association end. The name is optional and suppressible.

Various other notations can be placed near the end of the line as follows:

· A multiplicity.
· A property string enclosed in curly braces. The following property strings can be applied to an association end:
· {subsets <property-name>} to show that the end is a subset of the property called <property-name>.
· {redefined <end-name>} to show that the end redefines the one named <end-name>.
· {union} to show that the end is derived by being the union of its subsets.
· {ordered} to show that the end represents an ordered set.
· {bag} to show that the end represents a collection that permits the same element to appear more than once.
· {sequence} or {seq} to show that the end represents a sequence (an ordered bag).
· if the end is navigable, any property strings that apply to an attribute.

Note that by default an association end represents a set.

A stick arrowhead on the end of an association indicates the end is navigable. A small x on the end of an association indicates the end is not navigable. A visibility symbol can be added as an adornment on a navigable end to show the end's visibility as an attribute of the featuring classifier.

If the association end is derived, this may be shown by putting a slash in front of the name, or in place of the name if no name is shown.

The notation for an attribute can be applied to a navigable assocation end name.

A composite aggregation is shown using the same notation as a binary association, but with a solid, filled diamond at the aggregate end.

Presentation Options

When two lines cross, the crossing may optionally be shown with a small semicircular jog to indicate that the lines do not intersect (as in electrical circuit diagrams).

Various options may be chosen for showing navigation arrows on a diagram. In practice, it is often convenient to suppress some of the arrows and crosses and just show exceptional situations:

If there are two or more aggregations to the same aggregate, they may be drawn as a tree by merging the aggregation ends into a single segment. Any adornments on that single segment apply to all of the aggregation ends.

Style Guidelines

Lines may be drawn using various styles, including orthogonal segments, oblique segments, and curved segments. The choice of a particular set of line styles is a user choice.

Generalizations between associations are best drawn using a different color or line width than what is used for the associations.

Examples

Figure 31 shows a binary association from Player to Year named PlayedInYear. The solid triangle indicates the order of

reading: Player PlayedInYear Year. The figure further shows a ternary association between Team, Year, and Player with ends named team, season, and goalie respectively.

The following example shows association ends with various adornments.


The following adornments are shown on the four association ends in Figure 32.

· Names a, b, and d on three of the ends.
· Multiplicities 0..1 on a, * on b, 1 on the unnamed end, and 0..1 on d.
· Specification of ordering on b.
· Subsetting on d. For an instance of class C, the collection d is a subset of the collection b. This is equivalent to the OCL constraint:
        context C inv: b->includesAll(d)

The following examples show notation for navigable ends.

In Figure 33:

Figure 34 shows a navigable end using attribute notation. A navigable end is an attribute, so it can be shown using attribute notation. Normally this notation would be used in conjunction with the line-arrow notation to make it perfectly clear that the navigable ends are also attributes.

Figure 35 shows the notation for a derived union. The attribute A::b is derived by being the strict union of all of the attributes

that subset it. In this case there is just one of these, A1::b1. So for an instance of the class A1, b1 is a subset of b, and b is derived from b1.

Figure 36 shows the black diamond notation for composite aggregation.



Class (from Kernel)

A class describes a set of objects that share the same specifications of features, constraints, and semantics.

Description

Class is a kind of classifier whose features are attributes and operations. Attributes of a class are represented by instances of Property that are owned by the class. Some of these attributes may represent the navigable ends of binary associations.

Attributes

No additional attributes.

Associations

Constraints

No additional constraints.

Additional Operations

[1] The inherit operation is overridden to exclude redefined properties.

Class::inherit(inhs: Set(NamedElement)) : Set(NamedElement);
inherit = inhs->excluding(inh |
    ownedMember->select(oclIsKindOf(RedefinableElement))->select(redefinedElement->includes(inh)))

Semantics

The purpose of a class is to specify a classification of objects and to specify the features that characterize the structure and behavior of those objects.

Objects of a class must contain values for each attribute that is a member of that class, in accordance with the characteristics of the attribute, for example its type and multiplicity.

When an object is instantiated in a class, for every attribute of the class that has a specified default, if an initial value of the attribute is not specified explicitly for the instantiation, then the default value specification is evaluated to set the initial value of the attribute for the object.

Operations of a class can be invoked on an object, given a particular set of substitutions for the parameters of the operation. An operation invocation may cause changes to the values of the attributes of that object. It may also return a value as a result, where a result type for the operation has been defined. Operation invocations may also cause changes in value to the attributes of other objects that can be navigated to, directly or indirectly, from the object on which the operation is invoked, to its output parameters, to objects navigable from its parameters, or to other objects in the scope of the operation's execution. Operation
invocations may also cause the creation and deletion of objects.

Notation

A class is shown using the classifier symbol. As class is the most widely used classifier, the keyword "class" need not be shown in guillemets above the name. A classifier symbol without a metaclass shown in guillemets indicates a class.

Presentation Options

A class is often shown with three compartments. The middle compartment holds a list of attributes while the bottom compartment holds a list of operations.

Attributes or operations may be presented grouped by visibility. A visibility keyword or symbol can then be given once for multiple features with the same visibility.

Additional compartments may be supplied to show other details, such as constraints, or to divide features.

Style Guidelines

Examples



Property (from Kernel, AssociationClasses)

A property is a structural feature.

When a property is owned by a class it represents an attribute. In this case it relates an instance of the class to a value or set of values of the type of the attribute.

When a property is owned by an association it represents a non-navigable end of the association. In this case the type of the property is the type of the end of the association.

Description

Property represents a declared state of one or more instances in terms of a named relationship to a value or values. When a property is an attribute of a classifier, the value or values are related to the instance of the classifier by being held in slots of the instance. When a property is an association end, the value or values are related to the instance or instances at the other end(s) of the association (see semantics of Association).

Property is indirectly a subclass of Constructs::TypedElement. The range of valid values represented by the property can be controlled by setting the property's type.

Package AssociationClasses ("AssociationClasses" on page 117)

A property may have other properties (attributes) that serve as qualifiers.

Attributes
Associations

Package AssociationClasses ("AssociationClasses" on page 117)


Constraints

[1] If this property is owned by a class, associated with a binary association, and the other end of the association is also owned by a class, then opposite gives the other end.

opposite =
    if owningAssociation->notEmpty() and association.memberEnd->size() = 2 then
    let otherEnd = (association.memberEnd - self)->any() in
        if otherEnd.owningAssociation->notEmpty() then otherEnd else Set{} endif
    else Set {}
    endif

[2] A multiplicity on an aggregate end of a composite aggregation must not have an upper bound greater than 1.

isComposite implies (upperBound()->isEmpty() or upperBound() <= 1)

[3] Subsetting may only occur when the context of the subsetting property conforms to the context of the subsetted property.

subsettedProperty->notEmpty() implies
    (subsettingContext()->notEmpty() and subsettingContext()->forAll (sc |
        subsettedProperty->forAll(sp |
            sp.subsettingContext()->exists(c | sc.conformsTo(c)))))

[4] A navigable property (one that is owned by a class) can only be redefined or subsetted by a navigable property.

(subsettedProperty->exists(sp | sp.class->notEmpty())
    implies class->notEmpty())
    and
        (redefinedProperty->exists(rp | rp.class->notEmpty())
        implies class->notEmpty())

[5] A subsetting property may strengthen the type of the subsetted property, and its upper bound may be less.

subsettedProperty->forAll(sp |
    type.conformsTo(sp.type) and
    ((upperBound()->notEmpty() and sp.upperBound()->notEmpty()) implies
        upperBound()<=sp.upperBound() ))

[6] Only a navigable property can be marked as readOnly.

isReadOnly implies class->notEmpty()

[7] A derived union is derived.

isDerivedUnion implies isDerived

[8] A derived union is read only.

isDerivedUnion implies isReadOnly

[9] The value of isComposite is true only if aggregation is composite.

isComposite = (self.aggregation = #composite)

Additional Operations

[1] The query isConsistentWith() specifies, for any two Properties in a context in which redefinition is possible, whether redefinition would be logically consistent. A redefining property is consistent with a redefined property if the type of the redefining property conforms to the type of the redefined property, the multiplicity of the redefining property (if.specified) is contained in the multiplicity of the redefined property, and the redefining property is derived if the redefined attribute is
property.

Property::isConsistentWith(redefinee : RedefinableElement) : Boolean
pre: redefinee.isRedefinitionContextValid(self)
    isConsistentWith = (redefinee.oclIsKindOf(Property) and
    let prop: Property = redefinee.oclAsType(Property) in
        type.conformsTo(prop.type) and
        (lowerBound()->notEmpty and prop.lowerBound()->notEmpty() implies
            lowerBound() >= prop.lowerBound()) and
        (upperBound()->notEmpty and prop.upperBound()->notEmpty() implies
                upperBound() <= prop.upperBound()) and
        (prop.isDerived implies isDerived)
)

[2] The query subsettingContext() gives the context for subsetting a property. It consists, in the case of an attribute, of the corresponding classifier, and in the case of an association end, all of the classifiers at the other ends.

Property::subsettingContext() : Set(Type)
subsettingContext =
    if association->notEmpty()
    then association.endType-type
    else if classifier->notEmpty() then Set{classifier} else Set{} endif
    endif

Semantics

When a property is owned by a class or data type via ownedAttribute, then it represents an attribute of the class or data type.

When owned by an association via ownedEnd, it represents a non-navigable end of the association. In either case, when instantiated a property represents a value or collection of values associated with an instance of one (or in the case of a ternaryor higher-order association, more than one) type. This set of classifiers is called the context for the property; in the case of an attribute the context is the owning classifier, and in the case of an association end the context is the set of types at the other end or ends of the association.

The value or collection of values instantiated for a property in an instance of its context conforms to the property's type.

Property inherits from MultiplicityElement and thus allows multiplicity bounds to be specified. These bounds constrain the size of the collection. Typically and by default the maximum bound is 1.

Property also inherits the isUnique and isOrdered meta-attributes. When isUnique is true (the default) the collection of values may not contain duplicates. When isOrdered is true (false being the default) the collection of values is ordered. In combination these two allow the type of a property to represent a collection in the following way:


Table 2 - Collection types for properties
isOrdered isUnique Collection type
false true Set
true true OrderedSet
false false Bag
true false Sequence

If there is a default specified for a property, this default is evaluated when an instance of the property is created in the absence of a specific setting for the property or a constraint in the model that requires the property to have a specific value. The evaluated default then becomes the initial value (or values) of the property.

If a property is derived, then its value or values can be computed from other information. Actions involving a derived property behave the same as for a nonderived property. Derived properties are often specified to be read-only (i.e. clients cannot directly change values). But where a derived property is changeable, an implementation is expected to appropriately change the source information of the derivation. The derivation for a derived property may be specified by a constraint.

The name and visibility of a property are not required to match those of any property it redefines.

A derived property can redefine one which is not derived. An implementation must ensure that the constraints implied by the derivation are maintained if the property is updated.

If a property has a specified default, and the property redefines another property with a specified default, then the redefining property's default is used in place of the more general default from the redefined property.

If a navigable property (attribute) is marked as readOnly then it cannot be updated, once it has been assigned an initial value.A property may be marked as the subset of another, as long as every element in the context of subsetting property conforms to the corresponding element in the context of the subsetted property. In this case, the collection associated with an instance of the subsetting property must be included in (or the same as) the collection associated with the corresponding instance of the subsetted property.

A property may be marked as being a derived union. This means that the collection of values denoted by the property in some context is derived by being the strict union of all of the values denoted, in the same context, by properties defined to subset it.

If the property has a multiplicity upper bound of 1, then this means that the values of all the subsets must be null or the same.

A property may be owned by and in the namespace of a datatype.


Package AssociationClasses ("AssociationClasses" on page 117)

A qualifier declares a partition of the set of associated instances with respect to an instance at the qualified end (the qualified instance is at the end to which the qualifier is attached). A qualifier instance comprises one value for each qualifier attribute.

Given a qualified object and a qualifier instance, the number of objects at the other end of the association is constrained by the declared multiplicity. In the common case in which the multiplicity is 0..1, the qualifier value is unique with respect to the qualified object, and designates at most one associated object. In the general case of multiplicity 0..*, the set of associated instances is partitioned into subsets, each selected by a given qualifier instance. In the case of multiplicity 1 or 0..1, the
qualifier has both semantic and implementation consequences. In the case of multiplicity 0..*, it has no real semantic consequences but suggests an implementation that facilitates easy access of sets of associated instances linked by a given qualifier value.

Note ­ The multiplicity of a qualifier is given assuming that the qualifier value is supplied. The "raw" multiplicity without the qualifier is assumed to be 0..*. This is not fully general but it is almost always adequate, as a situation in which the raw multiplicity is 1 would best be modeled without a qualifier.

Note ­ A qualified multiplicity whose lower bound is zero indicates that a given qualifier value may be absent, while a lower bound of 1 indicates that any possible qualifier value must be present. The latter is reasonable only for qualifiers with a finite number of values (such as enumerated values or integer ranges) that represent full tables indexed by some finite range of values.

Notation

Notation for properties is defined separately for their use as attributes and association ends. Examples of subsetting and derived union are shown for associations. See "Classifier (from Kernel, Dependencies, PowerTypes)"  See "Association (from Kernel)" .

Package AssociationClasses ("AssociationClasses" on page 117)

A qualifier is shown as a small rectangle attached to the end of an association path between the final path segment and the symbol of the classifier that it connects to. The qualifier rectangle is part of the association path, not part of the classifier. The qualifier is attached to the source end of the association.

The multiplicity attached to the target end denotes the possible cardinalities of the set of target instances selected by the pairing of a source instance and a qualifier value.

The qualifier attributes are drawn within the qualifier box. There may be one or more attributes shown one to a line. Qualifier attributes have the same notation as classifier attributes, except that initial value expressions are not meaningful.

It is permissible (although somewhat rare), to have a qualifier on each end of a single association.

A qualifier may not be suppressed.

Style Guidelines

Package AssociationClasses ("AssociationClasses" on page 117)

The qualifier rectangle should be smaller than the attached class rectangle, although this is not always practical.

Examples

Package AssociationClasses ("AssociationClasses" on page 117)