Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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 Jul 04 03:59:42 EDT 2025

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

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

Back to the top