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] Fri, 21 March 2014 00:05 Go to next message
Johnny Soab is currently offline Johnny SoabFriend
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 12:42 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 913
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 Nov 28 11:18:13 GMT 2014

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

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