Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EVL] Access to parent node
[EVL] Access to parent node [message #1274064] Thu, 20 March 2014 20:05 Go to next message
Johnny Soab is currently offline Johnny Soab
Messages: 1
Registered: March 2014
Junior Member
Hi,

I have a simple metamodel defined as follows:


class Model {
  val Root[1] root;
}

class Node {
  attr String name;
  val Child[*] childs;
}

class Root extends Node {
}

class Child {
}

class Mand extends Node, Child {
}


I can therefore create two nodes with a reference between them. How can I, with two nodes between them through EVL, access to the parent node? I tried "Node.self" but it gives me error.. is there any way?

Thank you!
Re: [EVL] Access to parent node [message #1274414 is a reply to message #1274064] Fri, 21 March 2014 08:42 Go to previous message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 804
Registered: July 2009
Senior Member
Hi Johny,

The quick and dirty way is to use EMF's eContainer() operation (i.e. self.eContainer()). The proper way is to define an opposite reference in your metamodel e.g.

class Node {
attr String name;
val Child[*]#parent children;
ref Child#children parent;
}

Cheers,
Dimitris
Previous Topic:How to refer to UML profile within ETL module
Next Topic:sortedBy
Goto Forum:
  


Current Time: Fri Aug 01 10:00:22 EDT 2014

Powered by FUDForum. Page generated in 0.01504 seconds