[ATL] inter-model reference [message #743656] |
Fri, 21 October 2011 16:38  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04058 seconds