Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » [Epsilon]EWL finding reverse references
[Epsilon]EWL finding reverse references [message #385323] Wed, 03 September 2008 22:45 Go to next message
Kimon Polychroniadis is currently offline Kimon Polychroniadis
Messages: 30
Registered: July 2009
Member
Hi,

I have 5 model elements, A,B,C,D,E. There are reference relations
between them, i.e.

A relatesTo B (A-->B)
B relatesTo C (B-->C)
C relatesTo D (C-->D)
C relatesTo E (C-->E)

and I want to navigate through the model, following the reverse order of
the references. I.e. navigate from E to C, or from C to B. However, if I
use the 'relatesTo' reference, I'd get an empty set. Is there any way to
use the reference relations in the reverse order (navigation-wise I mean)?

Thanks in advance,
Kimon
Re: [Epsilon]EWL finding reverse references [message #385324 is a reply to message #385323] Thu, 04 September 2008 04:07 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Kimon,

In case you have

class A {
ref B b;
}

you can find the A(s) that refer to a particular b as follows:

A.all.select(a|a.b = b)

Another option is to modify your metamodel and add opposite references i.e.

class A {
ref B#a b;
}

class B {
ref A#b a;
}

in which case you can then navigate using b.a

Cheers,
Dimitris

Kimon Polychroniadis wrote:
> Hi,
>
> I have 5 model elements, A,B,C,D,E. There are reference relations
> between them, i.e.
>
> A relatesTo B (A-->B)
> B relatesTo C (B-->C)
> C relatesTo D (C-->D)
> C relatesTo E (C-->E)
>
> and I want to navigate through the model, following the reverse order of
> the references. I.e. navigate from E to C, or from C to B. However, if I
> use the 'relatesTo' reference, I'd get an empty set. Is there any way to
> use the reference relations in the reverse order (navigation-wise I mean)?
>
> Thanks in advance,
> Kimon
Re: [Epsilon]EWL finding reverse references [message #621754 is a reply to message #385323] Thu, 04 September 2008 04:07 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Kimon,

In case you have

class A {
ref B b;
}

you can find the A(s) that refer to a particular b as follows:

A.all.select(a|a.b = b)

Another option is to modify your metamodel and add opposite references i.e.

class A {
ref B#a b;
}

class B {
ref A#b a;
}

in which case you can then navigate using b.a

Cheers,
Dimitris

Kimon Polychroniadis wrote:
> Hi,
>
> I have 5 model elements, A,B,C,D,E. There are reference relations
> between them, i.e.
>
> A relatesTo B (A-->B)
> B relatesTo C (B-->C)
> C relatesTo D (C-->D)
> C relatesTo E (C-->E)
>
> and I want to navigate through the model, following the reverse order of
> the references. I.e. navigate from E to C, or from C to B. However, if I
> use the 'relatesTo' reference, I'd get an empty set. Is there any way to
> use the reference relations in the reverse order (navigation-wise I mean)?
>
> Thanks in advance,
> Kimon
Previous Topic:[Epsilon]EWL finding reverse references
Next Topic:[MOFScript] Modeling Tool
Goto Forum:
  


Current Time: Sat Aug 23 15:20:19 EDT 2014

Powered by FUDForum. Page generated in 0.01879 seconds