Hi Christian,
Thanks for the pointer to InterpreterUtil.applyToResource(…)! This helps me to solve my current problem.
However, some more explanations/arguments:
If you delete an object which is contained by another object, then it is automatically removed from the resource as well. Why should this not be the same for objects which are root objects in a resource?
In other words, if you have a rule which contains a node in the lhs but not in the rhs, then you would expect that after application of the rule the node is not contained in the host graph anymore. If you then apply the same rule on the resource a second
time, you expect that the node is not matched to the same object in the host graph again (since the object should not be part of the host graph anymore) as this would otherwise contradict the semantics of the delete action. In the current implementation,
the matched object is still in the resource after the application of the rule and you can apply the same rule with the same matching again.
The other way around works, so if you create an object, which has no containment relation to another object, it is added to the resource as root object during the rule application.
But maybe this boils down to my misunderstanding of the relation between the resource and the graph which is created from the objects in a resource?
Best regards,
Matthias
Hi Matthias,
thanks a lot for the patch. I am not sure though whether a rule should really remove objects from their resource(?).
Anyway, there is already a solution in Henshin for this problem: InterpreterUtil.applyToResource(...)
But this works only for one resource.
Cheers,
Christian
|