Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] inter-model reference
[ATL] inter-model reference [message #743656] Fri, 21 October 2011 16:38 Go to next message
giovi disanto is currently offline giovi disantoFriend
Messages: 58
Registered: September 2011
Member
hi,
i'm trying to do a trasformation with atl. I take two models of the same Metamodel type and one model of another metamodel type in output. I've checked "allow inter-model references" but i don't understand a particular behaviour of ATL.

When i try to do this:

module mngr2ctxmngr;
create OUT : CtxManager from IN1 : Manager, IN2 : Manager;

helper def : counter : Integer = 0;

rule test{
	from
		i : Manager!ManagerState in IN1

	to
		o_1: CtxManager!CtxState(
			name <- i.name,
			managerStates <- Manager!ManagerState.allInstancesFrom('IN2')->asSequence()->first()	
		)
	}



a receive this model as output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:contextmanager="http://www.kermeta.org/contextmanager">
  <contextmanager:CtxState name="1A">
    <managerStates href="source/manager2.mngr#//@ownedState.0"/>
  </contextmanager:CtxState>
  <contextmanager:CtxState name="1B">
    <managerStates href="source/manager2.mngr#//@ownedState.0"/>
  </contextmanager:CtxState>
</xmi:XMI>


That's exactly what i wont but when i try to do fo example this:

rule test{
	from
		i : Manager!ManagerState in IN1

	to
		o_1: CtxManager!CtxState(
			name <- i.name,
			managerStates <- i	
		)
	}



i receive this model as output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:contextmanager="http://www.kermeta.org/contextmanager">
  <contextmanager:CtxState name="1A" managerStates="/0"/>
  <contextmanager:CtxState name="1B" managerStates="/1"/>
</xmi:XMI>


Why there is not a reference href in this way? it seems that it's happens when i try to do a reference with the source pattern element.... how do i get even here a reference as in the first example?
Re: [ATL] inter-model reference [message #749851 is a reply to message #743656] Tue, 25 October 2011 13:32 Go to previous messageGo to next message
giovi disanto is currently offline giovi disantoFriend
Messages: 58
Registered: September 2011
Member
In the last case ATL maybe applies a binding between source model element and target model element generated from this source model element and retrieve a ref of this generated element in the target model? If it's correct there is a method to retrive a ref od source model element?

Thanks and sorry for my poor english
Re: [ATL] inter-model reference [message #786733 is a reply to message #749851] Mon, 30 January 2012 19:12 Go to previous messageGo to next message
José Miguel P. is currently offline José Miguel P.Friend
Messages: 62
Registered: March 2010
Member

Hi

I've been reading your post, and I'm having the same case.

Have you been any problem with the second type of inter-model-references in previous transformations? Do you know how I can force the first type of references?

Thanks you very much and sorry for my English.
Re: [ATL] inter-model reference [message #792908 is a reply to message #743656] Tue, 07 February 2012 14:57 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
On 21/10/11 18:38, giovi wrote:
> *snip*
> That's exactly what i wont but when i try to do fo example this:
>
>
> rule test{
> from
> i : Manager!ManagerState in IN1
>
> to
> o_1: CtxManager!CtxState(
> name <- i.name,
> managerStates <- i
> )
> }
>
>
>
> i receive this model as output:
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:contextmanager="http://www.kermeta.org/contextmanager">
> <contextmanager:CtxState name="1A" managerStates="/0"/>
> <contextmanager:CtxState name="1B" managerStates="/1"/>
> </xmi:XMI>
>
>
> Why there is not a reference href in this way? it seems that it's happens when
> i try to do a reference with the source pattern element.... how do i get even
> here a reference as in the first example?

Well, you're transforming 'i' into 'o_1', so when you assign 'i' to
'managerStates', ATL's implicit tracing mechanism will replace it by 'o_1'.
Hence, it becomes a self-reference. To avoid this, use the '<:=' assignment
operator instead of '<-', which should bypass implicit tracing.

Cheers,
Dennis
Re: [ATL] inter-model reference [message #793839 is a reply to message #792908] Wed, 08 February 2012 16:35 Go to previous message
José Miguel P. is currently offline José Miguel P.Friend
Messages: 62
Registered: March 2010
Member

Thanks you very much Dennis.
It seems to work fine.

I have not found this kind of assignment at the literature, so I din't know thing about it's existence.

Thanks you!
Previous Topic:What is the best way to merge two metamodels?
Next Topic:[QVTrelational] How to use Keys to preserve graph structure
Goto Forum:
  


Current Time: Mon Nov 24 21:52:03 GMT 2014

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

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