Une image contenant texte, signe

Description générée automatiquement

Context Pattern Editor – Contains Constraint

 

Contains Constraint

Syntax:

.contains (pattern)

The contains constraint is an advanced constraint that allows a token to be constrained by an entire context pattern.

For example:

Package.contains(Block)

Matches any top-level package that contains Blocks

Project*,{pkg}Package+.contains(Block.contains(ValueProperty))

Matches any package that contains Blocks that have Value Properties

Note that for table patterns, Rhapsody ignores any named token that is inside a contains, for example Rhapsody would ignore the {blk} part of this pattern:

Project*,{pkg}Package+.contains({blk}Block.contains(ValueProperty))

If you wanted to capture the Blocks as well has using them as a condition you should repeat the pattern:

Project*,{pkg}Package+.contains(Block.contains(ValueProperty)),{blk}Block.contains(ValueProperty)

Editing Contains Constraints

To use contains constraints in the Context Pattern Editor, first create child patterns by clicking Add Pattern. New patterns are automatically named P1, P2 and so on and appear as tabs in the editor:

 

A screen shot of a computer error

Description automatically generated

 

In any pattern editor, if the Constraint Type is set to Contains then the Constraint field is a combo box of child patterns:

A screenshot of a computer

Description automatically generated