01_user_documentation:07_rgg_xl:02_xl:03_query:04_context
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| 01_user_documentation:07_rgg_xl:02_xl:03_query:04_context [2025/09/04 10:10] – created gaetan | 01_user_documentation:07_rgg_xl:02_xl:03_query:04_context [2025/09/04 10:26] (current) – gaetan | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| 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. | 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: | + | Context is marked by asterisked parenthesis: |
| ===== Example ===== | ===== Example ===== | ||
| + | <code java> | ||
| + | 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 '' | ||
| + | |||
| + | The first rule ('' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | The '' | ||
| + | |||
| + | {{: | ||
01_user_documentation/07_rgg_xl/02_xl/03_query/04_context.1756973454.txt.gz · Last modified: 2025/09/04 10:10 by gaetan
