[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmt] Re: [Epsilon]EWL finding reverse references

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