A set expression is an expression that returns a set. It is made up of
identifiers (names of sets), and set operations. Identifiers have been
described in Section 8.5.1.2 "Identifiers". The admissible set operations are:
A+B: the union of A and B.
If both A and B are regular sets, the resulting set will be a regular
set containing the elements that occur in A or in B or both.
If A or B is a multiset, the resulting set will be a multiset,
respecting the cardinality of elements. For example, if element
e occurs five times in multiset A, and twice in multiset B, its
cardinality in the union is seven. If B is a regular set containing
element e, the cardinality of e in the union is six.
A*B: the intersection of A and B.
If A or B is a regular set, the resulting set will be a regular set
containing the elements that occur both in A and in B.
If both A and B are multisets, the resulting set will be a multiset,
respecting the cardinality of elements. For example, if element
e occurs five times in multiset A, and twice in multiset B, its
cardinality in the intersection is two.
A-B: A without B.
If A is a regular set, the resulting set will be a regular set
containing all elements that occur in A but not in B.
If A is a multiset, the resulting set will be a multiset, respecting
the cardinality of elements. For example, if element
e occurs five times in multiset A, and twice in multiset B, its
cardinality in the resulting set is three. If B is a regular set containing
element e, the cardinality of e in the resulting set is four.
a.B: set B of model element a.
The dot operator (see Section 8.5.2.2 "Special Operators") is also available in set
expressions. The difference is that the right hand side, B, must be a
set expression. Evaluating expression a.B for model element
e thus works as follows:
Evaluate metric expression a for model element
e. This yields a second model element, e'.
Evaluate set expression B for model element
e'. This is the result of a.B.
If an error occurs during evaluation of expression a or
B, or if expression a does not yield a model
element, no error is reported. Instead, a regular empty set is
returned as value of a.B.
The dot operator has precedence over the * operator, which has precedence
over the + and - operators. A+B-C is equivalent to (A+B)-C, not A+(B-C). Use
parenthesis to enforce the intended precedence.
An example for a valid set expression is ((A+B)-context.C)*D.