|Re: [henshin-user] Match depending on the number of edges|
one feature that might be useful to implement this are Aggregations. Aggregations can be used to count a number of references of a certain type, just as required in the example: http://www.ckrause.org/2015/11/aggregations-in-henshin.html
However, it might not be possible to implement the full desired behavior in only one rule: the result of counting is only available after the multi-rule used for counting has been matched (which happens chronologically after the matching of the kernel rule, where you already need the count).
You could still implement the behavior by storing the count for each Class1 and later using it for matching. This can be achieved by two rules: The first one counts for each Class1 the number of its Class2 references, and stores that number into an auxiliary object (e.g. a UML annotation, or a Trace object from Henshin's built-in generic Trace meta-model ). There should be one such auxiliary object created for each Class1. The second rule takes the desired number of Class2 references as an input parameter, and matches it against the numbers stored in the auxiliary objects.
It's certainly a verbose way to do it. Having counting as a language feature would be an interesting research topic of its own.
Am 26.10.2017 um 17:28 schrieb Zschaler, Steffen: