Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Reference to input model in output model
[ATL] Reference to input model in output model [message #535712] Tue, 25 May 2010 07:17 Go to next message
Eclipse UserFriend
Hello,

is it possible to have a matched rule that creates an output element that has a reference to an input model element and not to the transformed element?
I have a rule like that:
rule Element {
	from s : InputMM!Element
	to t : OutputMM!Element(
		name <- s.name
		trace <- s
	)
}

I want the trace-reference (of type EObject) to reference the input model and not itself.

Thanks,
Max
Re: [ATL] Reference to input model in output model [message #535727 is a reply to message #535712] Tue, 25 May 2010 08:27 Go to previous messageGo to next message
Eclipse UserFriend
I did have that problem recently and managed to do it by injecting twice the model as input.

from IN : InputMM, IN2 : InputMM2;

then for the trace binding you have to identify the s element in your IN2 model.

trace <- InputMM2!Element.allInstancesFrom('IN2')->select()

I wanted to use the EMF URI system by doing : ->select(e | e.eResource().getURIFragment(e) = s.eResource().getURIFragment(s))->first()
but this only works in EMF VM because of the eResource() and then the s element is still used (which will become t)

So to make it work you have to use the Regular VM and find s yourself :
->select(e | e.name = s.name)->first() if the name is unique.

Don't forget to activate the allowInterModelReferences option.
Re: [ATL] Reference to input model in output model [message #535761 is a reply to message #535727] Tue, 25 May 2010 10:16 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your help! I found another solution: It is possible to set the reference in the do-block (only available in normal execution mode, not in refining mode). In the do block, no implicit matching is done.

Thanks again,
Max
Re: [ATL] Reference to input model in output model [message #535763 is a reply to message #535761] Tue, 25 May 2010 10:20 Go to previous message
Eclipse UserFriend
Max Bureck wrote on Tue, 25 May 2010 10:16
Thanks for your help! I found another solution: It is possible to set the reference in the do-block (only available in normal execution mode, not in refining mode). In the do block, no implicit matching is done.

Thanks again,
Max

Great, I'll try that then
Previous Topic:[ATL]How to register ATL Meta Model
Next Topic:extract element of sequence
Goto Forum:
  


Current Time: Sat Apr 26 14:58:23 EDT 2025

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

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

Back to the top