Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Navigation between the elements of a MetaModel With ATL
Navigation between the elements of a MetaModel With ATL [message #1232830] Fri, 17 January 2014 21:26 Go to next message
Amine Nafdou is currently offline Amine NafdouFriend
Messages: 4
Registered: January 2014
Junior Member
Hello,
My problem is as follows:



i can't put the code or the image because the forum don't let me(You can only use links to eclipse.org sites while you have fewer than 5 messages.)

so i'll try to describe the every MetaModel.

I have a MetaModel A:
that defines a root element named A which is the parent of B which is the parent of C
,each element have an attribut name:EString

I have a MetaModel B:
that defines one element that have 2 attributs:
- name of element(which is the name of element C)
- bigParent(which is the big parent of that C which is the element A who is the parent of B who is the parent of that C).

[/code]
I'm trying to create an ATL file:

Who will do the following:

- Transform all elements of C MMa to elements of MMb

name of the element <- name of C
bigParent of element <- parent B is the parent of C (name of A)

-- @path MA=/Example/metamodels/MMA.ecore
-- @path MB=/Example/metamodels/MMB.ecore

module test;
create OUT : MB from IN : MA;



rule ABC2Element {
from c : MA!C
to element: MB!Element(
name <- c.name ,
bigParent <- <== ??!!! here is the question Smile
)
}

Thank you in advance.
Re: Navigation between the elements of a MetaModel With ATL [message #1235446 is a reply to message #1232830] Fri, 24 January 2014 11:43 Go to previous messageGo to next message
Victor Pavon is currently offline Victor PavonFriend
Messages: 50
Registered: April 2012
Location: Spain
Member
Hello Amine,

You could use the function refInmediateComposite() that give you the parent of the C element in this case B. To obtain the A parent you could deffine a recursive helper like this:

helper context oclAny def : getBigParent() : mmA!A = 
  if self.refInmediateComposite().oclIsTypeOf(mmA!A) then
     self.refInmediateComposite()
  else
     self.refInmediateComposite().getBigParent()
  endif;


Best regards,
Víctor.


Víctor Pavón,
Research at Quercus Software Engineering Group
University of Extremadura, Spain.
Re: Navigation between the elements of a MetaModel With ATL [message #1236710 is a reply to message #1235446] Mon, 27 January 2014 22:46 Go to previous messageGo to next message
Amine Nafdou is currently offline Amine NafdouFriend
Messages: 4
Registered: January 2014
Junior Member
Hello Victor,

Thank you very much for your response, i will try it, and tell you the results Smile, and if it's possible can i contact you ??

Thank you in advance Smile
Re: Navigation between the elements of a MetaModel With ATL [message #1236718 is a reply to message #1236710] Mon, 27 January 2014 23:20 Go to previous messageGo to next message
Amine Nafdou is currently offline Amine NafdouFriend
Messages: 4
Registered: January 2014
Junior Member
Hi there,

i tried your solution and that's what i got :

org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: IN!C1:MA!C.refInmediateComposite()

Thank you in advance Smile
Re: Navigation between the elements of a MetaModel With ATL [message #1236742 is a reply to message #1236718] Tue, 28 January 2014 01:01 Go to previous messageGo to next message
Victor Pavon is currently offline Victor PavonFriend
Messages: 50
Registered: April 2012
Location: Spain
Member
Hi,

Sorry there is an error in the name of method. The correct name is refImmediateComposite().


Best regards, Víctor.


Víctor Pavón,
Research at Quercus Software Engineering Group
University of Extremadura, Spain.
Re: Navigation between the elements of a MetaModel With ATL [message #1236818 is a reply to message #1236742] Tue, 28 January 2014 06:07 Go to previous message
Amine Nafdou is currently offline Amine NafdouFriend
Messages: 4
Registered: January 2014
Junior Member
Hi Mister Victor,
Thank you a lot for your response, that was very helpful, you solved the problem.

Thank you Very Happy

[Updated on: Tue, 28 January 2014 06:20]

Report message to a moderator

Previous Topic:[ATL] Error loading UML profiles programmatically
Next Topic:[ATL] serialise xmi to specific format
Goto Forum:
  


Current Time: Thu Apr 25 07:39:21 GMT 2024

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

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

Back to the top