Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Evaluation - get all the elements that are linked to selected element within a collection
Evaluation - get all the elements that are linked to selected element within a collection [message #1178197] Sat, 09 November 2013 08:12 Go to next message
Zarko Milosavljevic is currently offline Zarko Milosavljevic
Messages: 2
Registered: November 2013
Junior Member
I'd like to know if there's a way, and if yes, how to get list (or any other collection for that matter) of all the elements that are linked to targeted element. I'm writing dsl for data flow diagram and i need this in order to check if decomposition has been done properly. The example would be that process d is linked to data storage a, and external entity b, and by basic rules of decomposition, if you're decomposing by process d you need to have all of the elements that he was connected to on lower level of decomposition.
Re: Evaluation - get all the elements that are linked to selected element within a collection [message #1180099 is a reply to message #1178197] Sun, 10 November 2013 14:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 840
Registered: July 2009
Senior Member
Hi Zarko,

You can compute a collection of all the elements that refer to a particular element by navigating the appropriate references in the metamodel. For example, for models conforming to the metamodel in [1], to find all the books and libraries connected to a particular writer "w1", you could use the following EOL program:

var w1 : Writer; // The writer in question
var connected : Sequence; // All elements directly connected to that writer
w1 = ...;
connected.addAll(w1.books);
connected.addAll(Library.all.select(l|l.writers.includes(w1)));
connected.println();

Does this help?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/reflective-emf-tutorial/
Re: Evaluation - get all the elements that are linked to selected element within a collection [message #1181207 is a reply to message #1180099] Mon, 11 November 2013 07:52 Go to previous message
Zarko Milosavljevic is currently offline Zarko Milosavljevic
Messages: 2
Registered: November 2013
Junior Member
Yes, very helpful indeed. It gave me an idea to the approach i should take to solve my problem. Thank you very much!
Previous Topic:Setting xsi:noNamespaceSchemaLocation in generated xsd-back xml
Next Topic:ecl ant task doesn't "see" inherited elements from a metamodel
Goto Forum:
  


Current Time: Sat Aug 30 14:30:18 EDT 2014

Powered by FUDForum. Page generated in 0.01511 seconds