Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » resolve duplicate elements of the target model
resolve duplicate elements of the target model [message #54906] Thu, 26 July 2007 12:07 Go to next message
Yury Kornev is currently offline Yury KornevFriend
Messages: 8
Registered: July 2009
Junior Member
hi all,

ATL do not allow to navigate over the target model. But if i created
multiple different target elements (A1, .. ,Ai, .. An)from one source
element (S), i need to set correct references to this elements, so how
it can be done?
When i define the reference with the type to the S then it is always
transformed to one specific Ai. It is not possible to use
resolveTemp()-method because all Ai are constructed using one target
pattern. I thought to create my own tracing within the transformation,
but perhaps there is "better" solution.

thanks

regars,
Yury Kornev
[ATL] Re: resolve duplicate elements of the target model [message #54987 is a reply to message #54906] Fri, 27 July 2007 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quentin.glineur.obeo.fr

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

Hi,

Please prefix you post subject with [ATL], thanks !

I may have not understood everything but:
resolveTemp() is the function to use to get the reference to a
particular (i.e. not the first) target element when it has been created
by a multi-target rule.

So, what do you mean by "constructed using one target pattern" ?
(I understand a rule whose target is defined as follows :

to
t1 : Persons!Man, t2 : Persons!Man, t3 : Persons!Man (
fullName <- s.firstName + ' ' + s.family.lastName
)
for wich only the last element will be initialised)

HTH,

Quentin GLINEUR

kornev a
Re: [ATL] Re: resolve duplicate elements of the target model [message #55014 is a reply to message #54987] Fri, 27 July 2007 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: y_kornev.gmail.com

hi,

Quentin Glineur schrieb:
> Please prefix you post subject with [ATL], thanks !
sorry, next time i will be more carefully

> I may have not understood everything but:
> resolveTemp() is the function to use to get the reference to a
> particular (i.e. not the first) target element when it has been created
> by a multi-target rule.

the question is how to get the reference to the one specific target
element (that was created through the lazy rule or distinct-foreach)
from the set of elements matched to one source element,e.g

from ob : MOF!EClass
to t1 : MOF!EClass(...)
do {
for (iterate in sequence) {
Lazyrule(ob);
}
}
Lazyrule{
to t : MOF!EClass (...)

}

if i undestood right, ATL engine traces all target elements, in this
case it provides only one reference (to t1)
but what happens to the elements initialized through the Lazyrule?

regards,
yury

>
> So, what do you mean by "constructed using one target pattern" ?
> (I understand a rule whose target is defined as follows :
>
> to
> t1 : Persons!Man, t2 : Persons!Man, t3 : Persons!Man (
> fullName <- s.firstName + ' ' + s.family.lastName
> )
> for wich only the last element will be initialised)
>
> HTH,
>
> Quentin GLINEUR
>
> kornev a écrit :
>> hi all,
>>
>> ATL do not allow to navigate over the target model. But if i created
>> multiple different target elements (A1, .. ,Ai, .. An)from one source
>> element (S), i need to set correct references to this elements, so how
>> it can be done?
>> When i define the reference with the type to the S then it is always
>> transformed to one specific Ai. It is not possible to use
>> resolveTemp()-method because all Ai are constructed using one target
>> pattern. I thought to create my own tracing within the transformation,
>> but perhaps there is "better" solution.
>>
>> thanks
>>
>> regars,
>> Yury Kornev
Re: [ATL] Re: resolve duplicate elements of the target model [message #55040 is a reply to message #55014] Fri, 27 July 2007 10:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matt.mcgill.gmail.com

Yury Kornev wrote:
> hi,
>
> Quentin Glineur schrieb:
>> Please prefix you post subject with [ATL], thanks !
> sorry, next time i will be more carefully
>
>> I may have not understood everything but:
>> resolveTemp() is the function to use to get the reference to a
>> particular (i.e. not the first) target element when it has been
>> created by a multi-target rule.
>
> the question is how to get the reference to the one specific target
> element (that was created through the lazy rule or distinct-foreach)
> from the set of elements matched to one source element,e.g
>
> from ob : MOF!EClass
> to t1 : MOF!EClass(...)
> do {
> for (iterate in sequence) {
> Lazyrule(ob);
> }
> }
> Lazyrule{
> to t : MOF!EClass (...)
>
> }
>

Are you sure you didn't meed Lazyrule(iterate)? Or did you really want
to create |sequence| number of EClasses from ob?

Anyway, you can do this by decorating the source model with the target
elements you're creating, using a combination of helper and called rule.
Like this: (using your example, creating many target elements from same
source element)

helper context MOF!EClass def:
derived : Sequence(MOF!EClass) =
self.sequence->collect(i |
thisModule.CalledRule(self)
);

rule CalledRule(source : MOF!EClass) {
to t : MOF!EClass (...)
}

Then any time you need to get any of the created objects, you can just
access the derived collection.

Did I understand your problem correctly?

-Matt McGill

> if i undestood right, ATL engine traces all target elements, in this
> case it provides only one reference (to t1)
> but what happens to the elements initialized through the Lazyrule?
>
> regards,
> yury
>
>>
>> So, what do you mean by "constructed using one target pattern" ?
>> (I understand a rule whose target is defined as follows :
>>
>> to
>> t1 : Persons!Man, t2 : Persons!Man, t3 : Persons!Man (
>> fullName <- s.firstName + ' ' + s.family.lastName )
>> for wich only the last element will be initialised)
>>
>> HTH,
>>
>> Quentin GLINEUR
>>
>> kornev a écrit :
>>> hi all,
>>>
>>> ATL do not allow to navigate over the target model. But if i created
>>> multiple different target elements (A1, .. ,Ai, .. An)from one
>>> source element (S), i need to set correct references to this
>>> elements, so how it can be done?
>>> When i define the reference with the type to the S then it is always
>>> transformed to one specific Ai. It is not possible to use
>>> resolveTemp()-method because all Ai are constructed using one target
>>> pattern. I thought to create my own tracing within the
>>> transformation, but perhaps there is "better" solution.
>>>
>>> thanks
>>>
>>> regars,
>>> Yury Kornev
Re: [ATL] Re: resolve duplicate elements of the target model [message #55317 is a reply to message #55040] Mon, 30 July 2007 13:48 Go to previous message
Yury Kornev is currently offline Yury KornevFriend
Messages: 8
Registered: July 2009
Junior Member
hi Matt,

i got your idea, thanks a lot

regards
yury kornev

Matt McGill schrieb:
> Yury Kornev wrote:
>> hi,
>>
>> Quentin Glineur schrieb:
>>> Please prefix you post subject with [ATL], thanks !
>> sorry, next time i will be more carefully
>>
>>> I may have not understood everything but:
>>> resolveTemp() is the function to use to get the reference to a
>>> particular (i.e. not the first) target element when it has been
>>> created by a multi-target rule.
>>
>> the question is how to get the reference to the one specific target
>> element (that was created through the lazy rule or distinct-foreach)
>> from the set of elements matched to one source element,e.g
>>
>> from ob : MOF!EClass
>> to t1 : MOF!EClass(...)
>> do {
>> for (iterate in sequence) {
>> Lazyrule(ob);
>> }
>> }
>> Lazyrule{
>> to t : MOF!EClass (...)
>> }
>>
>
> Are you sure you didn't meed Lazyrule(iterate)? Or did you really want
> to create |sequence| number of EClasses from ob?
>
> Anyway, you can do this by decorating the source model with the target
> elements you're creating, using a combination of helper and called rule.
> Like this: (using your example, creating many target elements from same
> source element)
>
> helper context MOF!EClass def:
> derived : Sequence(MOF!EClass) =
> self.sequence->collect(i |
> thisModule.CalledRule(self)
> );
>
> rule CalledRule(source : MOF!EClass) {
> to t : MOF!EClass (...)
> }
>
> Then any time you need to get any of the created objects, you can just
> access the derived collection.
>
> Did I understand your problem correctly?
>
> -Matt McGill
>
>> if i undestood right, ATL engine traces all target elements, in this
>> case it provides only one reference (to t1)
>> but what happens to the elements initialized through the Lazyrule?
>>
>> regards,
>> yury
>>
>>>
>>> So, what do you mean by "constructed using one target pattern" ?
>>> (I understand a rule whose target is defined as follows :
>>>
>>> to
>>> t1 : Persons!Man, t2 : Persons!Man, t3 : Persons!Man (
>>> fullName <- s.firstName + ' ' + s.family.lastName )
>>> for wich only the last element will be initialised)
>>>
>>> HTH,
>>>
>>> Quentin GLINEUR
>>>
>>> kornev a écrit :
>>>> hi all,
>>>>
>>>> ATL do not allow to navigate over the target model. But if i created
>>>> multiple different target elements (A1, .. ,Ai, .. An)from one
>>>> source element (S), i need to set correct references to this
>>>> elements, so how it can be done?
>>>> When i define the reference with the type to the S then it is always
>>>> transformed to one specific Ai. It is not possible to use
>>>> resolveTemp()-method because all Ai are constructed using one target
>>>> pattern. I thought to create my own tracing within the
>>>> transformation, but perhaps there is "better" solution.
>>>>
>>>> thanks
>>>>
>>>> regars,
>>>> Yury Kornev
Previous Topic:[ATL] transformations with multiple input metamodels/libraries failing from Java
Next Topic:[ATL] Launch a transformation from a java application
Goto Forum:
  


Current Time: Mon Jan 25 14:59:22 GMT 2021

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

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

Back to the top