Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » resolveTemp howto
resolveTemp howto [message #29406] Wed, 04 April 2007 15:30 Go to next message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

This is a multi-part message in MIME format.
--------------090109060809050507000707
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I've attached a file which shows the following problem:

----

rule testit {
from
t : behaviourView!MessageEnd
to
t2 : behaviourView!MessageEnd (
m <- thisModule.resolveTemp(t.m, 'm_sm2b'),

name <- thisModule.resolveTemp(t.m, 'm_sm2b').name
)
}


rule add_sendMessage {
from
m_sm1 : behaviourView!Message(m_sm1.name.toLower() = 'sendmessage')
to
m_sm2a : behaviourView!Message (
),
m_sm2b : behaviourView!Message (
name <- m_sm1.name + 'b'
)
}

----

In the rule testit, the first assignment (to t2.m) succeeds, the element
is correctly placed inside its container (see the output in
sd-out-sample.ecore)

But the second assignment in testit (to t2.name) fails. It gives an
empty result, but in my opinion it should return m_sm1.name + 'b'
because of analogy. How can this be solved?

The archive contains:
* sd-in-sample.ecore (the input model)
* sd-out-sample.ecore (the output model)
* behaviour.km3 (the metamodel for both the input and output)
* lb4sd.atl (the transformation with more 'failing' resolveTemp calls)

I'm using the bundled ATL+Eclipse download from
http://www.eclipse.org/m2m/atl/download/ and the default atl2004

Regards,
Rene

--------------090109060809050507000707
Content-Type: application/octet-stream;
name="show-problem.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="show-problem.zip"

UEsDBBQAAAAIAClWhDbnZ9Ue9QAAAG4CAAARAAAAYmVoYXZpb3VyVmlldy5r bTOVUj1vwjAQ
nRMp/+HmShnCCHPHiqpUXRCDk7zQaxM7so8ghPLfa0OBxmorsfl8T+/LznNy 3PUtN4yaBljH
Rmdplvaq+lRbUIl3NbDZ2TfGno5ZmlStco6W5QcqeUFzukuUiOVyJyCtOtCc Vn7W20XYWTSw
0BWoQ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GZApoh+EVcT5N k29U45u+4RSE
FRFQYVuO0rz7q8QJkiUeF1WH9XDGB9OlQgGm6mg4kQa+EjlaWzb4P220RX3f NtV6kBD1Zflm
LU/w7QvSH1BLAwQUAAAACAAkiYQ2dpDJlfQAAACFAQAAEgAAAHNkLWluLXNh bXBsZS5lY29y
ZU1QwW7DIAw9t1L/weXSywhrpUltRNJzD10Pk6Zd08RNmAJUQJru7+ckZBoS GPv5PT+Qx6du
4YHOK2sytk1eGaApbaVMnbHTx4Xv928HvmXHfLWUT63Sr/MJhvjH2RFntQRa JGV8SmDGmhDu
qRB93ydW14l1tSAim1oydsWmeCjbuU+FPcsn+nDKM3pf1Aim0Jgxj6aKlblL 6hkM6MM73WZk
Ia3DXQQd3viwdclEDnLNORRl6Iq2/YHNBGzgBSrlAz21U76Bm3UwaFIOnA+i Cyk0jupSRBtj
NlYu128sQxxHY2Z/ZOKfh3H+pDARooAU8TMp/wVQSwECFAAUAAAACAApVoQ2 52fVHvUAAABu
AgAAEQAAAAAAAAABACAAAAAAAAAAYmVoYXZpb3VyVmlldy5rbTNQSwECFAAU AAAACABDiYQ2
l4QRrOABAABcBAAACQAAAAAAAAABACAAAAAkAQAAbGI0c2QuYXRsUEsBAhQA FAAAAAgAJYmE
NjuAI5utAAAA/gAAABMAAAAAAAAAAQAgAAAAKwMAAHNkLW91dC1zYW1wbGUu ZWNvcmVQSwEC
FAAUAAAACAAkiYQ2dpDJlfQAAACFAQAAEgAAAAAAAAABACAAAAAJBAAAc2Qt aW4tc2FtcGxl
LmVjb3JlUEsFBgAAAAAEAAQA9wAAAC0FAAAAAA==
--------------090109060809050507000707--
Re: [ATL] resolveTemp howto [message #29480 is a reply to message #29406] Wed, 04 April 2007 15:38 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

Firstly, could you please prefix the subject of your posts with [ATL] to
avoid collisions with messages about the other components of M2M?


Secondly, navigating the target model is forbidden.
Because resolveTemp returns a target model element, you should not try
to get its name.

In order to avoid recomputing values (and having to change two pieces of
code in case of updates), you may use attribute helpers.
For instance:

helper context behaviourView!Message def: bName : String =
self.name + 'b';

Then, in rule testit, you would write:

name <- t.m.bName

and in rule add_sendMessage:

m_sm2b : behaviourView!Message (
name <- m_sm1.bName
)


Best regards,

Frédéric Jouault


Rene Ladan wrote:
> Hi,
>
> I've attached a file which shows the following problem:
>
> ----
>
> rule testit {
> from
> t : behaviourView!MessageEnd
> to
> t2 : behaviourView!MessageEnd (
> m <- thisModule.resolveTemp(t.m, 'm_sm2b'),
>
> name <- thisModule.resolveTemp(t.m, 'm_sm2b').name
> )
> }
>
>
> rule add_sendMessage {
> from
> m_sm1 : behaviourView!Message(m_sm1.name.toLower() = 'sendmessage')
> to
> m_sm2a : behaviourView!Message (
> ),
> m_sm2b : behaviourView!Message (
> name <- m_sm1.name + 'b'
> )
> }
>
> ----
>
> In the rule testit, the first assignment (to t2.m) succeeds, the element
> is correctly placed inside its container (see the output in
> sd-out-sample.ecore)
>
> But the second assignment in testit (to t2.name) fails. It gives an
> empty result, but in my opinion it should return m_sm1.name + 'b'
> because of analogy. How can this be solved?
>
> The archive contains:
> * sd-in-sample.ecore (the input model)
> * sd-out-sample.ecore (the output model)
> * behaviour.km3 (the metamodel for both the input and output)
> * lb4sd.atl (the transformation with more 'failing' resolveTemp calls)
>
> I'm using the bundled ATL+Eclipse download from
> http://www.eclipse.org/m2m/atl/download/ and the default atl2004
>
> Regards,
> Rene
Re: [ATL] resolveTemp howto [message #29616 is a reply to message #29480] Thu, 05 April 2007 07:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

Frédéric Jouault wrote:
> Hello,
>
> Firstly, could you please prefix the subject of your posts with [ATL] to
> avoid collisions with messages about the other components of M2M?
>
>
> Secondly, navigating the target model is forbidden.
> Because resolveTemp returns a target model element, you should not try
> to get its name.
>
Just like in XSLT... But ATL doesn't complain when I write something like

rule A {
from
m1 : model!elem
to
m2 : model!elem (
name <- f(m1.name) -- some function f(String) -> String
),
m3 : model!elem2 (
name <- g(m2.name) -- some function g(String) -> String
),
...
}

In this case m3.name gets the value of g(m2.name), with m2 being an
target model element. Is this a 'feature' in the ATL parser? I
probably should have used g(f(m1.name)) here.

Regards,
Rene
Re: [ATL] resolveTemp howto [message #30069 is a reply to message #29616] Thu, 05 April 2007 14:59 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

When you navigate the target model, results can vary: it *might* work
sometimes. But you should not rely on this.

In the future, ATL will be able to tell you when you navigate the target
model. However, the current version lets you try.


Best regards,

Frédéric Jouault


Rene Ladan wrote:
> Frédéric Jouault wrote:
>> Hello,
>>
>> Firstly, could you please prefix the subject of your posts with [ATL]
>> to avoid collisions with messages about the other components of M2M?
>>
>>
>> Secondly, navigating the target model is forbidden.
>> Because resolveTemp returns a target model element, you should not try
>> to get its name.
>>
> Just like in XSLT... But ATL doesn't complain when I write something like
>
> rule A {
> from
> m1 : model!elem
> to
> m2 : model!elem (
> name <- f(m1.name) -- some function f(String) -> String
> ),
> m3 : model!elem2 (
> name <- g(m2.name) -- some function g(String) -> String
> ),
> ...
> }
>
> In this case m3.name gets the value of g(m2.name), with m2 being an
> target model element. Is this a 'feature' in the ATL parser? I
> probably should have used g(f(m1.name)) here.
>
> Regards,
> Rene
Previous Topic:ATL refining mode
Next Topic:[ATL] UML2 Profiles support
Goto Forum:
  


Current Time: Fri Apr 19 21:04:18 GMT 2024

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

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

Back to the top