Focus on constraints and opaque expressions

Constraints

Constraints are expression to define the role or the scope of an element. They can be defined under every model elements. The same constraint can be applied on every element using the Constrained Elements reference. The element on which the constraint is applied is called the context of a constraint. Constraints always have only one context which is the owner of this constraint.

Constraints can be defined and represented on every kind of diagram


Hence, palette always define the three following tools to create constraint, to reference ConstraintElements or add an existing constraint in the diagram.


The expression of a constraint can be described by Literal Boolean Value, Boolean Reference, Unary or Binary Expressions or by Opaque Expression. The concept of Opaque Expression was added to give more freedom to express complex constraints than with Boolean expression.


Opaque Expressions

An opaque expression is an uninterpreted textual statement that denotes a (possibly empty) set of values when evaluated in a context. Opaque Expression value can be defined using multiple languages to represent the same expression. By default, Capella provides a Linked Text language which enable to reference elements from the model and from its referenced libraries.



Constraints label

The label of a constraint is either the name of the constraint or their expression (Unary, Binary or Opaque Expression). For constraint defined with opaque expression, the label is simply calculated from the first content which corresponds to the first language in the list. So the label can be adjusted by moving the language list order.

Constraints expression fields edition

As Linked Text editor, the direct edition of the following constraint expression fields include a content edition assist, simplifying model elements reference: