User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:03_query:04_context

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.

Example

module A;
module B;
module C;
module D;
protected void init ()
[
	Axiom ==> A [>D] B C;
]
public void ruleWithContext ()
[
   (*A [> D]*) B ==> C;
]
 
public void ruleNoContext ()
[
   A [> D] B ==> C;
]

produce the following graph:

The two rules declared above use the same query. Thus will match the same nodes. The first one (with context) will not replace the bounded A > D, while the second rule will.

The first rule (ruleWithContext) produce the following graph (notice that only the B node has been replaced by a C):

The ruleNoContext rule produce the following graph (the whole matched sub-graph is replaced):

01_user_documentation/07_rgg_xl/02_xl/03_query/04_context.txt · Last modified: 2025/09/04 10:26 by gaetan