Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » How to work with circular references?
How to work with circular references? [message #85549] Tue, 01 July 2008 12:20 Go to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
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?
Re: How to work with circular references? [message #85614 is a reply to message #85549] Wed, 02 July 2008 07:39 Go to previous message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Ok, I could write one B to Y,Z with the precondition, that the Z does not
exists and one B to Y rule with the precondition that Z does exists and
set the reference from B to the existing Z in the body of the rule. This
is a bit lengthy, because the B to Y rule does a lot. Maybe I can use
abstract rules and inheritance to eliminate the duplicate parts of the
rules.

> 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?
Previous Topic:Set stereotype tagged value
Next Topic:EMF Changeable problem
Goto Forum:
  


Current Time: Wed Sep 25 19:20:24 GMT 2024

Powered by FUDForum. Page generated in 0.02702 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top