Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » What is the meaning of "mapsTo"?
What is the meaning of "mapsTo"? [message #24559] Mon, 19 March 2007 16:37 Go to next message
Matthias Bohlen is currently offline Matthias BohlenFriend
Messages: 30
Registered: July 2009
Member
Hi Dennis,

in some of your transformations, I see the keyword "mapsTo":

rule DurationInterval {
from s : UML2!uml::DurationInterval (thisModule.inElements->includes(s))
to t : UML2!uml::DurationInterval mapsTo s ( ... )
}

What does this keyword do?

Cheers
Matthias
[ATL] Re: What is the meaning of "mapsTo"? [message #24829 is a reply to message #24559] Tue, 20 March 2007 16:32 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
Matthias Bohlen schreef:
> Hi Dennis,
>
> in some of your transformations, I see the keyword "mapsTo":
>
> rule DurationInterval {
> from s : UML2!uml::DurationInterval (thisModule.inElements->includes(s))
> to t : UML2!uml::DurationInterval mapsTo s ( ... )
> }
>
> What does this keyword do?
>
> Cheers
> Matthias
>

Short answer:
The keyword currently does nothing. You may ignore it.

Long answer:
The "mapsTo" keyword is meant to specify that "s" is replaced by "t" for
every reference to "s". The current behaviour of ATL is to always
replace the source element by the first target element. Consider the
following example:

rule A {
from s : UML!Class
to t : RDB!Table (
columns <- s.ownedAttribute)
}

rule B {
from s : UML!Attribute
to t : RDB!Column (
name <- s.name),
index : RDB!Index (
name <- s.name)
}

RDB!Table cannot contain UML!Attribute elements as columns (rule A).
That's why s.ownedAttribute is replaced with what it "mapsTo". This is
defined in rule B: each UML!Attribute is mapped to a RDB!Column. So,
what happens when I change the order of "t" and "index" in rule B?
Remember that only the first target element in each rule gets this
special "mapsTo" treatment: if each UML!Attribute maps to an RDB!Index,
rule A becomes invalid: it tries to assign a Sequence of RDB!Index to
columns.

I found this special treatment of the first target element too
significant to remain implicit and I've added the "mapsTo" keyword to
make it explicit.

I'm not sure if this was a wise decision, since it likely makes you
believe that you can use "mapsTo" on other target elements as well. This
is not true, since "mapsTo" does nothing at the moment. It also provokes
questions like "What does this keyword do?" ;-). I suppose Frédéric
should just take it out of the parser and force me to update my
transformations, so I can stop shooting myself in the foot with this ;-).
--
Regards,
Dennis
Re: [ATL] Re: What is the meaning of "mapsTo"? [message #25295 is a reply to message #24829] Fri, 23 March 2007 22:11 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi Dennis,

> I suppose Frédéric
> should just take it out of the parser and force me to update my
> transformations, so I can stop shooting myself in the foot with this ;-).

Well, taking mapsTo out of the parser would create some compatibility
issues (at least for your transformations ;-)).

Another solution would be to detect any use of mapsTo that attempts to
change the implemented behavior (e.g., using mapsTo on another element
than the first), and to report an error when this happens.
This way, using mapsTo the way you do would remain possible.


Best regards,

Frédéric Jouault
Previous Topic:Pass a parameters in atl command lines
Next Topic:[ATL] New FAQ entry: What's this ATL feature called "superimposition"?
Goto Forum:
  


Current Time: Tue Mar 19 03:02:54 GMT 2024

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

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

Back to the top