Kernel the Multiplicities Diagram
The Multiplicities diagram of the Kernel package is shown in Figure 10.

In order to locate the metaclasses that are referenced from this
diagram,
· See "Classifier (from
Kernel, Dependencies, PowerTypes)"
· See "Element (from Kernel)"
· See
"ValueSpecification
(from Kernel)"
MultiplicityElement (from Kernel)
A multiplicity is a definition of an inclusive interval of
non-negative integers beginning with a lower bound and ending
with a (possibly infinite) upper bound. A multiplicity element embeds
this information to specify the allowable cardinalities for an
instantiation of this element.
Description
A MultiplicityElement is an abstract metaclass which includes
optional attributes for defining the bounds of a multiplicity.
A MultiplicityElement also includes specifications of whether the
values in an instantiation of this element must be unique or ordered.
Attributes
- isOrdered:
Boolean
For a multivalued multiplicity, this attribute specifies whether the
values in an instantia-tion of this element are sequentially ordered.
Default is false.
- isUnique :
Boolean
For a multivalued multiplicity, this attributes specifies whether the
values in an instantiation of this element are unique. Default is true.
- / lower : Integer
[0..1] Specifies the lower
bound of the multiplicity interval, if it is expressed as an integer.
- / upper : UnlimitedNatural
[0..1] Specifies the upper
bound of the multiplicity interval, if it is expressed as an unlimited
natural.
Associations
- lowerValue: ValueSpecification [0..1] The
specification of the lower bound for this multiplicity. Subsets Element::ownedElement.
- upperValue: ValueSpecification [0..1] The
specification of the upper bound for this multiplicity. Subsets Element::ownedElement.
Constraints
These constraint must handle situations where the upper bound may
be specified by an expression not computable in the model.
[1] A multiplicity must define at least one valid cardinality that is
greater than zero.
upperBound()->notEmpty() implies upperBound() > 0
[2] The lower bound must be a non-negative integer literal.
lowerBound()->notEmpty() implies lowerBound() >= 0
[3] The upper bound must be greater than or equal to the lower bound.
(upperBound()->notEmpty() and lowerBound()->notEmpty()) implies
upperBound() >= lowerBound()
[4] If a non-literal ValueSpecification is used for the lower or upper
bound, then evaluating that specification must not have side effects.
Cannot be expressed in OCL.
[5] If a non-literal ValueSpecification is used for the lower or upper
bound, then that specification must be a constant expression.
Cannot be expressed in OCL.
[6] The derived lower attribute must equal the lowerBound.
lower = lowerBound()
[7] The derived upper attribute must equal the upperBound.
upper = upperBound()
Additional Operations
[1] The query isMultivalued() checks whether this multiplicity has
an upper bound greater than one.
MultiplicityElement::isMultivalued() : Boolean;
pre: upperBound()->notEmpty()
isMultivalued = (upperBound() > 1)
[2] The query includesCardinality() checks whether the specified
cardinality is valid for this multiplicity.
MultiplicityElement::includesCardinality(C : Integer) : Boolean;
pre: upperBound()->notEmpty() and
lowerBound()->notEmpty()
includesCardinality = (lowerBound() <= C) and (upperBound()
>= C)
[3] The query includesMultiplicity() checks whether this multiplicity
includes all the cardinalities allowed by the specified multiplicity.
MultiplicityElement::includesMultiplicity(M : MultiplicityElement) :
Boolean;
pre: self.upperBound()->notEmpty() and
self.lowerBound()->notEmpty()
and M.upperBound()->notEmpty() and
M.lowerBound()->notEmpty()
includesMultiplicity = (self.lowerBound() <= M.lowerBound()) and
(self.upperBound() >= M.upperBound())
[4] The query lowerBound() returns the lower bound of the multiplicity
as an integer.
MultiplicityElement::lowerBound() : [Integer];
lowerBound = if lowerValue->isEmpty() then 1 else
lowerValue.integerValue() endif
[5] The query upperBound() returns the upper bound of the
multiplicity for a bounded multiplicity as an unlimited natural.
MultiplicityElement::upperBound() : [UnlimitedNatural];
upperBound = if upperValue->isEmpty() then 1 else
upperValue.unlimitedValue() endif
Semantics
A multiplicity defines a set of integers that define valid
cardinalities. Specifically, cardinality C is valid for multiplicity M
if M.includesCardinality(C).
A multiplicity is specified as an interval of integers starting with
the lower bound and ending with the (possibly infinite) upper bound.
If a MultiplicityElement specifies a multivalued multiplicity, then an
instantiation of this element has a set of values. The multiplicity is
a constraint on the number of values that may validly occur in that set.
If the MultiplicityElement is specified as ordered (i.e. isOrdered is
true), then the set of values in an instantiation of this element is
ordered. This ordering implies that there is a mapping from positive
integers to the elements of the set of values. If a MultiplicityElement
is not multivalued, then the value for isOrdered has no semantic effect.
If the MultiplicityElement is specified as unordered (i.e. isOrdered is
false), then no assumptions can be made about the order of the values
in an instantiation of this element.
If the MultiplicityElement is specified as unique (i.e. isUnique is
true), then the set of values in an instantiation of this element must
be unique. If a MultiplicityElement is not multivalued, then the value
for isUnique has no semantic effect.
The lower and upper bounds for the multiplicity of a
MultiplicityElement may be specified by value specifications, such as
(side-effect free, constant) expressions.
Notation
The specific notation for a MultiplicityElement is defined by the
concrete subclasses. In general, the notation will include a
multiplicity specification is shown as a text string containing the
bounds of the interval, and a notation for showing the optional
ordering and uniqueness specifications.
The multiplicity bounds are typically shown in the format:
lower-bound..upper-bound
where lower-bound is an integer and upper-bound is
an unlimited natural number. The star character (*) is used as part of
a multiplicity specification to represent the unlimited (or infinite)
upper bound.
If the Multiplicity is associated with an element whose notation is a
text string (such as an attribute, etc.), the multiplicity string will
be placed within square brackets ([]) as part of that text string.
Figure 11 shows two multiplicity strings as part of attribute
specifications within a class symbol.
If the Multiplicity is associated with an element that appears as a
symbol (such as an association end), the multiplicity string is
displayed without square brackets and may be placed near the symbol for
the element. Figure 12 shows two multiplicity strings as part of the
specification of two association ends.
The specific notation for the ordering and uniqueness specifications
may vary depending on the specific subclass of MultiplicityElement. A
general notation is to use a property string containing ordered or
unordered to define the ordering, and unique or nonunique to define the
uniqueness.
Presentation Options
If the lower bound is equal to the upper bound, then an alternate
notation is to use the string containing just the upper bound. For
example, "1" is semantically equivalent to "1..1".
A multiplicity with zero as the lower bound and an unspecified upper
bound may use the alternative notation containing a single star "*"
instead of "0..*".
The following BNF defines the syntax for a multiplicity string,
including support for the presentation options.
multiplicity ::= <multiplicity_range> [ `{`
<order_designator> `}' ]
multiplicity_range ::= [ lower `..' ] upper
lower ::= integer | value_specification
upper ::= unlimited_natural | `*' | value_specification
<order_designator> ::= ordered | unordered
<uniqueness_designator> ::= unique | nonunique
Examples
Type (from Kernel)
A type constrains the values represented by a typed element.
Description
A type serves as a constraint on the range of values represented by
a typed element. Type is an abstract metaclass.
Attributes
No additional attributes.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
[1] The query conformsTo() gives true for a type that conforms to
another. By default, two types do not conform to each other. This query
is intended to be redefined for specific conformance situations.
conformsTo(other: Type): Boolean;
conformsTo = false
Semantics
A type represents a set of values. A typed element that has this
type is constrained to represent values within this set.
Notation
No general notation.
TypedElement (from Kernel)
A typed element has a type.
Description
A typed element is an element that has a type that serves as a
constraint on the range of values the element can represent.
Typed element is an abstract metaclass.
Attributes
No additional attributes.
Associations
- type: Type
[0..1]
The type of the TypedElement.
Constraints
No additional constraints.
Semantics
Values represented by the element are constrained to be instances of
the type. A typed element with no associated type may represent values
of any type.
Notation
No general notation.