6.1.6 All types and type
patterns
All types of a given metatype (Object, Property, Role,
Relationship or Port) can be denoted by () instead of a type name. This is
especially useful when you want to loop over, say, all objects, regardless of
their type, e.g.
.()
For elements other than properties, the brackets
can also contain one or more type name strings, separated by
|. A type name can contain wildcards,
e.g.
.(Class* | Package)
will run for all Classes,
Class-&-Objects, and Packages.
If a type name string is immediately preceded by a caret
^, instances matching that type string
are disallowed, e.g.
.(St* | ^State [UML])
will run for instances of
Start or Stop, but not State [UML] or Note.
To restrict based on type hierarchy, you can use
< and
<= followed by the supertype’s
name. To match instances whose type is descended from MySupertype:
.(<MySupertype)
To match instances whose type is
MySupertype or descended from it:
.(<=MySupertype)
These can be prefixed as before
with ^ for "AND NOT", e.g to match
instances of all of MySupertype's subtypes, except for BadType and its
subtypes:
.(<MySupertype | ^<=BadType)
Within
parentheses, the above syntax can be written as is. For a single type without
parentheses, the < and
= must both be escaped by backslashes:
.\<\=MySupertype — or just add
parentheses.
Please note that for Properties only the generic
:() clause is allowed: content inside
the parentheses (e.g.
:(Name*)) is not
supported.