![]() | Syntax |
---|---|
EntityAST ::= QualifiedTypeNameAST EntityBody ContainmentConstraintOptAST EntityBody ::= ( PatternVariableDefRefAST ) An entity is identified by a pattern variable.
It can have a type (
entity type
),
which is either a local name or a fully qualified name of a model element (
qualified model element name).
A type identifies another entity of the model space; it can be referenced with the local name only if its
namespace is imported.
In the most general case, the type is The location of an entity may be restricted by a containment constraint. |
![]() | Semantics |
---|---|
The semantics of an entity largely differs on whether this entity appears in a pattern used as a stand-alone pattern, or as a precondition or a postcondition of a GT rule definition. The semantics of the postcondition case is defined in details in GT rule definition. In case of pattern matching (precondition part or stand-alone patterns), an entity appearing in a pattern body prescribes that the corresponding pattern variable should be bound to an entity in the model space. Note that attribute conditions (e.g. accessing the value of an entity need to be specified as part of a check condition. During pattern matching the referenced entity must be located in the containment hierarchy according to the containment constraint. In case of the constraint the entity must be contained directly by the entity referenced by the container, whereas in case of the constraint the containment can be transitive (to find all ancestors). Needs to be checked. The container needs to be a constant, an ASM function, or (most typically) a pattern variable. In the latter case, the corresponding pattern variable needs to be bound prior to pattern matching (i.e. it is an input parameter of the pattern). If there are multiple containment constraints for an entity (for instance, from the caller ASM choose rule or forall rule), all constraints need to be satisfied for a successful match. Thus, if the constraints are contradictionary, pattern matching will fail. In case of postcondition patterns, an entity appearing in a pattern body may prescribe that a new entity has to be created in the model space, and this new entity is then assigned to the corresponding pattern variable. Concerning containment constraints used in postcondition patterns,
The container is allowed to be a constant, an ASM function, or a pattern variable. In the latter case, it is allowed to have another entity referred by the pattern variable of the container. In case of postcondition patterns, contradicting multiple containment constraints result in a runtime error. |
![]() | Constraints |
---|---|
Referencing to the
value
of an entity is not allowed in entity definitions. The value property
can be accessed in check conditions
as |
![]() | Warning |
---|---|
The |
Defined In: pattern body
Used By: create rule
See Also: pattern body, namespace import