tutorials:common_rewriting_rules
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| tutorials:common_rewriting_rules [2024/05/02 17:37] – created TimOb | tutorials:common_rewriting_rules [2025/01/10 11:15] (current) – gaetan | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| Of the two structural rules this one is much more commonly used in GroIMP. | Of the two structural rules this one is much more commonly used in GroIMP. | ||
| It replaces each instance of the pattern defined on the left side with the new created graph structure on the right side. | It replaces each instance of the pattern defined on the left side with the new created graph structure on the right side. | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | So if all A's in the model should be replaced by F's the patterns a the A's and the new structure is an F: | ||
| + | < | ||
| + | A ==> F; | ||
| + | </ | ||
| + | ==== pattern side ==== | ||
| - | ===== SPO stlye ===== | + | |
| + | The definition of the pattern that should be replaced can be defined by using [[: | ||
| + | |||
| + | < | ||
| + | A[F] ==> F; | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | first((*A*)) ==> F; | ||
| + | </ | ||
| + | |||
| + | Additionally the pattern can be defined using conditions: | ||
| + | |||
| + | < | ||
| + | A(1)==> | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | a: | ||
| + | </ | ||
| + | |||
| + | ==== structure side ==== | ||
| + | |||
| + | A more complex structure can be created by using the [[: | ||
| + | < | ||
| + | A ==> F [RL(90) F A] F +> A; | ||
| + | </ | ||
| + | With the addition of modules and 3d objects more object oriented nodes can be added: | ||
| + | < | ||
| + | A ==> F [RL(90) Cylinder(1, | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== SPO style ===== | ||
| SPO: Single pushout graph rewriting | SPO: Single pushout graph rewriting | ||
| Line 16: | Line 58: | ||
| ====== Execution rule ====== | ====== Execution rule ====== | ||
| + | <code java> | ||
| + | |||
| + | [ < | ||
| + | |||
| + | </ | ||
| + | |||
| + | e.g. | ||
| + | |||
| + | <code java> | ||
| + | |||
| + | [ a:A ::> println( a ); ] | ||
| + | |||
| + | </ | ||
tutorials/common_rewriting_rules.1714664233.txt.gz · Last modified: 2024/05/02 17:37 by TimOb
