Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » 1..* transformation in QVT
1..* transformation in QVT [message #531081] Mon, 03 May 2010 16:19 Go to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
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 11:57 Go to previous messageGo to next message
Eclipse UserFriend
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
>
Re: 1..* transformation in QVT [message #531359 is a reply to message #531277] Tue, 04 May 2010 15:32 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
I solved in this way....

i not use "mapping" more, but "query" instead...

I know that is not a good thing, but seems be the only way to "map" several object from one. In the query a create as many objects I need and I link them to the target with intermediate properties...


thank you!

[Updated on: Wed, 19 May 2010 11:16]

Report message to a moderator

Re: 1..* transformation in QVT [message #534493 is a reply to message #531081] Wed, 19 May 2010 11:08 Go to previous messageGo to next message
simonsen  is currently offline simonsen Friend
Messages: 2
Registered: May 2010
Junior Member
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.
Re: 1..* transformation in QVT [message #534498 is a reply to message #534493] Wed, 19 May 2010 11:22 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
yes... similar problem.

As said before, I solved without mapping, but with query (and helpers) in which I create programmatically new objects. Then I link these new objects (of the target model) to the source object with an intermediate property.

that is to say...

A -- 1..* -->B intermediate property "custom resolve"

B --1..1 -->A intermediate property "custom Invresolve"


from A, I choose which instance of B I need checking the parent of B (in my model I have objects that contain other objects)
Re: 1..* transformation in QVT [message #534533 is a reply to message #531081] Wed, 19 May 2010 12:59 Go to previous messageGo to next message
simonsen  is currently offline simonsen Friend
Messages: 2
Registered: May 2010
Junior Member
i am pretty positive that there shall exist a way with avoiding using querys and helper functions.

If it were possible to only get the cartesian product of the relation
A -- 1..* --> B created via the mappings / relations, then the rest is just filtering out unwanted elements of that set.
[QVTr] Re: 1..* transformation in QVT [message #534985 is a reply to message #534493] Thu, 20 May 2010 21:22 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7679
Registered: July 2009
Senior Member
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.
Previous Topic:while
Next Topic:UML2OWL transformation gives error
Goto Forum:
  


Current Time: Thu Nov 14 14:54:04 GMT 2024

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

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

Back to the top