Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [Epsilon]EWL finding reverse references
[Epsilon]EWL finding reverse references [message #385323] Thu, 04 September 2008 02:45 Go to next message
Kimon Polychroniadis is currently offline Kimon PolychroniadisFriend
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 08:07 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
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 08:07 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
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: Fri Apr 26 23:20:56 GMT 2024

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

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

Back to the top