1..* transformation in QVT [message #531081] |
Mon, 03 May 2010 12:19  |
Eclipse User |
|
|
|
I have a problem with a 1..* transformation.
i.e.
a class of the source model becomes several instances in the target model.
If i do A::AtoB():B several times, the mapping is executed only one time. I need instead that it's executed each time, creating new B instances in the target model.
For now the only way I found to do this, is create new instances programmatically ( object B {...} or deepclone() ) but in this way i can't use "resolve" on new instances.
There should be a way to do this, right? Otherwise resolveIn was useless ...
thank you
Daniele
|
|
|
Re: 1..* transformation in QVT [message #531277 is a reply to message #531081] |
Tue, 04 May 2010 07:57   |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
Hello daniele,
I'm in no way an export in QVT, but I'll try to answer your questions
with the knowledge I do have.
> If i do A::AtoB():B several times, the mapping is executed only one
> time. I need instead that it's executed each time, creating new B
> instances in the target model.
Assuming AtoB is a mapping, the first time you map something using that
mapping, a new target element is created. Each time after that, the
trace information is used to get that same target element, if you map
the same source element using the same mapping function (and with the
same parameters). I think that is the way it is officially defined.
> For now the only way I found to do this, is create new instances
> programmatically ( object B {...} or deepclone() ) but in this
> way i can't use "resolve" on new instances.
I use deepclone() as well. I haven't found another way to do it. So far,
I haven't really used resolve yet, I just map it again, and get the same
result. However, if you have mappings with parameters and you don't have
the parameters available at each point where you need to map, you might
need to 'late resolve' instead.
Dennis
daniele wrote:
> I have a problem with a 1..* transformation.
>
> i.e.
> a class of the source model becomes several instances in the target model.
>
> If i do A::AtoB():B several times, the mapping is executed only one
> time. I need instead that it's executed each time, creating new B
> instances in the target model.
>
> For now the only way I found to do this, is create new instances
> programmatically ( object B {...} or deepclone() ) but in this way
> i can't use "resolve" on new instances.
>
> There should be a way to do this, right? Otherwise resolveIn was
> useless ...
>
> thank you
>
> Daniele
>
|
|
|
|
|
|
|
[QVTr] Re: 1..* transformation in QVT [message #534985 is a reply to message #534493] |
Thu, 20 May 2010 17:22  |
Eclipse User |
|
|
|
Hi Simonsen
The QVTr specification does not fully explore the consequences of
collections. It seems to try to simplify the compilation complexities,
but in doing so creates limitations and inconsistencies.
I suspect that once these are fully resolved, it will be necessary
to adopt the UMLX philosphy of all possible maximal matches which
results in Cartesian products just as you require.
So the QVTr expression could be elegant; just needs the specification
and the tools to catch up.
Regards
Ed Willink
On 19/05/2010 12:08, simonsen wrote:
> Hello,
> i have a similar issue in QVT Relations Language.
> I need to generate multiple instances in the target model, from a single
> object in the source model, if certain constraints are fullfilled.
> In particular my source model snippet looks like this:
>
> Object A has a 1..* relations to objects B and C each. For every valid
> triple of ( A->B && A->C ) an instance in the target model shall be
> enforced.
>
> Is there any elegant way to implement this with the relations language?
>
> Thanks alot,
> best regards.
|
|
|
Powered by
FUDForum. Page generated in 0.07503 seconds