Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Getting the name of parent container in ATL
Getting the name of parent container in ATL [message #1766946] Wed, 28 June 2017 22:50 Go to next message
Ruchika Kumar is currently offline Ruchika KumarFriend
Messages: 43
Registered: January 2017
Member
Is there any way I can get the name of parent or parent of parent of a node in input while transforming using ATL?

For example, my input model is of the form:

<ucmMaps name="MapA">
<paths name="start">
<pathBody>
<pathNodes name="check"/>
</pathBody>
</paths>
</ucmMaps>

and I want to get the ucmMap name ("mapA" in this case) for pathNode "check". I will need to go two or more (not fixed) level up the hierarchy and get the name of the required parent container.


Re: Getting the name of parent container in ATL [message #1767628 is a reply to message #1766946] Fri, 07 July 2017 19:28 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 351
Registered: September 2012
Location: Belgium
Senior Member

refImmediateComposite() will do that.

Cheers,
Dennis
Re: Getting the name of parent container in ATL [message #1767629 is a reply to message #1767628] Fri, 07 July 2017 19:31 Go to previous messageGo to next message
Ruchika Kumar is currently offline Ruchika KumarFriend
Messages: 43
Registered: January 2017
Member
Wouldn't it give me the PathBody here? This is just an example and the input model could also have pathbody inside another pathbody/ies and then i need to get the name of the path.
Re: Getting the name of parent container in ATL [message #1767632 is a reply to message #1767629] Fri, 07 July 2017 19:37 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 351
Registered: September 2012
Location: Belgium
Senior Member

You can write a recursive helper method that goes all the way up until refImmediateComposite() returns OclUndefined, or until it returns the element type you're looking for (oclIsKindOf()).

Cheers,
Dennis
Previous Topic:Getting Stereotypes for Model transformations
Next Topic:Tutorials for working with UML Stereotypes and Composite Structure Diagrams
Goto Forum:
  


Current Time: Fri Nov 24 15:11:28 GMT 2017

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

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