| [news.eclipse.modeling.m2m] Re: How to work with circular references? |
Hello,
I'm having some trouble with circular references lately. How do I cope with the situation, that two output elements have references to the same third element?
In one case it was like that:
Input model: A |-B |-B
Mappings: A to X B to Y,Z
Output model: X |-Y--Z |-Y-/
So that both Y-model elements have a reference to the same Z.
Is there declarative way to express that?
My only idea is to create a helper-method, which is called in Mapping B to Y that checks if Z already exists. If Z exists, it returns it, if not, it calls a lazy rule creating Z. Is this the way to go, or is there a better way?