This is an old revision of the document!
Context
The notion of context in the rule-based paradigm refers to some structure which has to exist within the current host structure and which is related in some way with the match, but which is not replaced on rule application. Thus, in a query, marking context on some predicate enable to use these patterns to match and ensure that the Nodes bounded by these patterns will not be removed or replaced.
Context is marked by asterisked parenthesis: (* and *). These are the same symbols used for declaring query expressions, but the two concepts are different.
In the case of custom patterns it defines if the Node matched by this pattern are “kept” after the matching. The custom patterns simply forward the context of their caller query to their own pattern. For instance:
void rule()[ Node -p-> Node ==>; // p is not a context Node -p-> Node ::>; // p is a context Node (* -p-> Node *) ==>; // p is a context ]
A custom pattern p that is not a context makes all Nodes bound by its matching transient. Even the Node implicitly bound.
