Kernel the Expressions Diagram
The Expressions diagram of the Kernel package is shown in Figure 13.

In order to locate the metaclasses that are referenced from this
diagram,
· See "Element (from Kernel)" .
· See
"InstanceSpecification
(from Kernel)" .
· See
"MultiplicityElement (from
Kernel)".
Expression (from Kernel)
An expression is a structured tree of symbols that denotes a (possibly
empty) set of values when evaluated in a context.
Description
An expression represents a node in an expression tree, which may be
non-terminal or terminal. It defines a symbol, and has a possibly empty
sequence of operands which are value specifications.
Attributes
- symbol: String [1] The symbol associated with the
node in the expression tree.
Associations
- operand: ValueSpecification[*] Specifies a
sequence of operands. Subsets Element::ownedElement.
Constraints
No additional constraints.
Semantics
An expression represents a node in an expression tree. If there are
no operands it represents a terminal node. If there are operands it
represents an operator applied to those operands. In either case there
is a symbol associated with the node. The interpretation of this symbol
depends on the context of the expression.
Notation
By default an expression with no operands is notated simply by its
symbol, with no quotes. An expression with operands is notated by its
symbol, followed by round parentheses containing its operands in order.
In particular contexts special notations may be permitted, including
infix operators.
Examples
xor
else
plus(x,1)
x+1
OpaqueExpression (from Kernel)
An opaque expression is an uninterpreted textual statement that denotes
a (possibly empty) set of values when evaluated in a context.
Description
An expression contains a language-specific text string used to
describe a value or values, and an optional specification of the
language.
One predefined language for specifying expressions is OCL. Natural
language or programming languages may also be used.
Attributes
- body: String [1] The text of the expression.
- language: String [0..1] Specifies the language in
which the expression is stated. The interpretation of the expression
body depends on the language. If language is unspecified, it might be
implicit from the expression body or the context.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
These operations are not defined within the specification of UML.
They should be defined within an implementation that implements
constraints so that constraints that use these operations can be
evaluated.
[1] The query value() gives an integer value for an expression intended
to produce one.
Expression::value(): Integer;
pre: self.isIntegral()
[2] The query isIntegral() tells whether an expression is intended to
produce an integer.
Expression::isIntegral(): Boolean;
[3] The query isPositive() tells whether an integer expression has a
positive value.
Expression::isPositive(): Boolean;
pre: self.isIntegral()
[4] The query isNonNegative() tells whether an integer expression has a
non-negative value.
Expression::isNonNegative(): Boolean;
pre: self.isIntegral()
Semantics
The interpretation of the expression body depends on the language.
If the language is unspecified, it might be implicit from the
expression body or the context.
It is assumed that a linguistic analyzer for the specified language
will evaluate the body. The time at which the body will be evaluated is
not specified.
Notation
An opaque expression is displayed as a text string in a particular
language. The syntax of the string is the responsibility of a tool and
a linguistic analyzer for the language.
An opaque expression is displayed as a part of the notation for its
containing element.
The language of an opaque expression, if specified, is often not shown
on a diagram. Some modeling tools may impose a particular language or
assume a particular default language. The language is often implicit
under the assumption that the form of the expression makes its purpose
clear. If the language name is shown, it should be displayed in braces
({}) before the expression string.
Style Guidelines
A language name should be spelled and capitalized exactly as it
appears in the document defining the language. For example, use OCL,
not ocl.
Examples
a > 0
{OCL} i > j and self.size > i
average hours worked per week
InstanceValue (from Kernel)
An instance value is a value specification that identifies an instance.
Description
An instance value specifies the value modeled by an instance
specification.
Attributes
No additional attributes.
Associations
- instance: InstanceSpecification [1] The
instance that is the specified value.
Constraints
No additional constraints.
Semantics
The instance specification is the specified value.
Notation
An instance value can appear using textual or graphical notation.
When textual, as can appear for the value of an attribute slot, the
name of the instance is shown. When graphical, a reference value is
shown by connecting to the instance. See "InstanceSpecification".
LiteralBoolean (from Kernel)
A literal boolean is a specification of a boolean value.
Description
A literal boolean contains a Boolean-valued attribute.
Attributes
- value: Boolean The specified Boolean value.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
[1] The query isComputable() is redefined to be true.
LiteralBoolean::isComputable(): Boolean;
isComputable = true
[2] The query booleanValue() gives the value.
LiteralBoolean::booleanValue() : [Boolean];
booleanValue = value
Semantics
A LiteralBoolean specifies a constant Boolean value.
Notation
A LiteralBoolean is shown as either the word `true' or the word
`false', corresponding to its value.
LiteralInteger (from Kernel)
A literal integer is a specification of an integer value.
Description
A literal integer contains an Integer-valued attribute.
Attributes
- value: Integer The specified Integer value.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
[1] The query isComputable() is redefined to be true.
LiteralInteger::isComputable(): Boolean;
isComputable = true
[2] The query integerValue() gives the value.
LiteralInteger::integerValue() : [Integer];
integerValue = value
Semantics
A LiteralInteger specifies a constant Integer value.
Notation
A LiteralInteger is shown as a sequence of digits.
LiteralNull (from Kernel)
A literal null specifies the lack of a value.
Description
A literal null is used to represent null, i.e., the absence of a
value.
Attributes
No additional attributes.
Associations
No additional associations.
Constraints
No additional constraints.
[1] The query isComputable() is redefined to be true.
LiteralNull::isComputable(): Boolean;
isComputable = true
[2] The query isNull() returns true.
LiteralNull::isNull() : Boolean;
isNull = true
Semantics
LiteralNull is intended to be used to explicitly model the lack of
a value.
Notation
Notation for LiteralNull varies depending on where it is used. It
often appears as the word `null'. Other notations are described for
specific uses.
LiteralSpecification (from
Kernel)
A literal specification identifies a literal constant being modeled.
Description
A literal specification is an abstract specialization of
ValueSpecification that identifies a literal constant being modeled.
Attributes
No additional attributes.
Associations
No additional associations.
Constraints
No additional constraints.
Semantics
No additional semantics. Subclasses of LiteralSpecification are
defined to specify literal values of different types.
Notation
No specific notation.
LiteralString (from
Kernel)
A literal string is a specification of a string value.
Description
A literal string contains a String-valued attribute.
Attributes
- value: String The specified String value.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
[1] The query isComputable() is redefined to be true.
LiteralString::isComputable(): Boolean;
isComputable = true
[2] The query stringValue() gives the value.
LiteralString::stringValue() : [String];
stringValue = value
Semantics
A LiteralString specifies a constant String value.
Notation
A LiteralString is shown as a sequence of characters within double
quotes.
The character set used is unspecified.
LiteralUnlimitedNatural (from
Kernel)
A literal unlimited natural is a specification of an unlimited natural
number.
Description
A literal unlimited natural contains a UnlimitedNatural-valued
attribute.
Attributes
- value: UnlimitedNatural The specified
UnlimitedNatural value.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
[1] The query isComputable() is redefined to be true.
LiteralUnlimitedNatural::isComputable(): Boolean;
isComputable = true
[2] The query unlimitedValue() gives the value.
LiteralUnlimitedNatural::unlimitedValue() : [UnlimitedNatural];
unlimitedValue = value
Semantics
A LiteralUnlimitedNatural specifies a constant UnlimitedNatural
value.
Notation
A LiteralUnlimitedNatural is shown either as a sequence of digits
or as an asterisk (*), where an asterisk denotes unlimited (and not
infinity).
ValueSpecification (from Kernel)
A value specification is the specification of a (possibly empty) set of
instances, including both objects and data values.
Description
ValueSpecification is an abstract metaclass used to identify a
value or values in a model. It may reference an instance or it may be
an expression denoting an instance or instances when evaluated.
Attributes
- expression: Expression[0..1] If this value
specification is an operand, the owning expression. Subsets Element::owner.
Associations
No additional associations.
Constraints
No additional constraints.
Additional Operations
These operations are introduced here. They are expected to be
redefined in subclasses. Conforming implementations may be able to
compute values for more expressions that are specified by the
constraints that involve these operations.
[1] The query isComputable() determines whether a value specification
can be computed in a model. This operation cannot be fully defined in
OCL. A conforming implementation is expected to deliver true for this
operation for all value specifications that it can compute, and to
compute all of those for which the operation is true.
A conforming implementation is expected to be able to compute the value
of all literals.
ValueSpecification::isComputable(): Boolean;
isComputable = false
[2] The query integerValue() gives a single Integer value when one can
be computed.
ValueSpecification::integerValue() : [Integer];
integerValue = Set{}
[3] The query booleanValue() gives a single Boolean value when one can
be computed.
ValueSpecification::booleanValue() : [Boolean];
booleanValue = Set{}
[4] The query stringValue() gives a single String value when one can be
computed.
ValueSpecification::stringValue() : [String];
stringValue = Set{}
[5] The query unlimitedValue() gives a single UnlimitedNatural value
when one can be computed.
ValueSpecification::unlimitedValue() : [UnlimitedNatural];
unlimitedValue = Set{}
[6] The query isNull() returns true when it can be computed that the
value is null.
ValueSpecification::isNull() : Boolean;
isNull = false
Semantics
A value specification yields zero or more values. It is required that
the type and number of values is suitable for the context where the
value specification is used.
Notation
No specific notation.