Previous UML Classes Table of Contents UML Packages Next


7.3.35 OpaqueExpression

Kernel


   An opaque expression is an uninterpreted textual statement that denotes a (possibly empty) set of values when evaluated in a context.

*Generalizations

   

    ValueSpecification (from Kernel ) on page 140

*Description

   An expression contains language-specific text strings used to describe a value or values, and an optional specification of the languages.

   One predefined language for specifying expressions is OCL. Natural language or programming languages may also be used.

*Attributes

   Issue 9191 - change lower bound to 0

*Associations

   No additional associations

*Constraints

   Issue 8100 - Clarify semantics of multiple languages co-existing in the same expression. 9191 -remove second constraint introduced by 8100

   [1] If the language attribute is not empty, then the size of the body and language arrays must be the same.

   language->notEmpty() implies (body->size() = language->size())

*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

   Issue 8100 - Clarify semantics of multiple languages co-existing in the same expression.

   The expression body may consist of a sequence of text strings - each in a different language - representing alternative representations of the same content. When multiple language strings are provided, the language of each separate string is determined by its corresponding entry in the "language" attribute (by sequence order). The interpretation of the text strings is language specific. Languages are matched to body strings by order. If the languages are unspecified, they might be implicit from the expression bodies or the context.

   It is assumed that a linguistic analyzer for the specified languages will evaluate the bodies. The times at which the bodies will be evaluated are not specified.

*Notation

   An opaque expression is displayed as text strings in particular languages. The syntax of the strings are the responsibility of a tool and linguistic analyzers for the languages.

   An opaque expression is displayed as a part of the notation for its containing element.

Issue 8100 - Clarify semantics of multiple languages co-existing in the same expression.

   The languages of an opaque expression, if specified, are 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 to which it corresponds.

*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 > iaverage hours worked per week