Home » Archived » GMT (Generative Modeling Technologies) » [Epsilon]EWL finding reverse references
[Epsilon]EWL finding reverse references [message #385323] |
Wed, 03 September 2008 22:45  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Sun Mar 16 00:12:03 EDT 2025
Powered by FUDForum. Page generated in 0.03716 seconds
|