Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Unique Matched Rule !
Unique Matched Rule ! [message #538223] Sun, 06 June 2010 17:44 Go to next message
zoro  is currently offline zoro
Messages: 26
Registered: April 2010
Junior Member
I want to produce a single one element from 2 source elements, I could use "unique lazy rule", but the problem is, there is no place to call it ... so its "un-applicable" ....

For example consider the example of Families to Persons !
rule Member2Male {froms : Families!Member (not s.isFemale())
     to t : Persons!Male (
                  fullName <-s.firstName + ' '+ s.familyName
      )


This rule transforms a Member into a Male, but I want to to transform 2 Members (they have the same name, same properties ...) into 1 same Male ? Now how to do that ??

Your help is much appreciated !

[Updated on: Sun, 06 June 2010 22:55]

Report message to a moderator

Re: Unique Matched Rule ! [message #538595 is a reply to message #538223] Tue, 08 June 2010 07:53 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 523
Registered: July 2009
Senior Member
You can have in the from section of the rules multiple elements :

from s : Families!Member, t : Families!Member (s.name = t.name)
Re: Unique Matched Rule ! [message #538767 is a reply to message #538223] Tue, 08 June 2010 15:18 Go to previous messageGo to next message
zoro  is currently offline zoro
Messages: 26
Registered: April 2010
Junior Member
Sylvain, Thanks for your reply, but that does not solve the problep, actually that way it creates 4 target elements instead of just 2 !

Any other idead is very welcome !
Re: Unique Matched Rule ! [message #538782 is a reply to message #538223] Tue, 08 June 2010 15:23 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHE
Messages: 129
Registered: July 2009
Senior Member
Le 06/06/2010 19:44, zoro a écrit :
> I want to produce a single one element from 2 source elements, I could
> use "unique lazy rule", but the problem is, there is no place to call it
> ... so its "un-applicable" ....

Using the OCL allInstances in place of match rule, you be able to call
the unique lazy rule ????
>
> For example consider the example of Families to Persons !
> rule Member2Male {froms : Families!Member (not s.isFemale())tot :
> Persons!Male (fullName <-s.firstName + ' '+ s.familyName)
>
> This rule transforms a Member into a Male, but I want to to transform 2
> Members into 1 same Male ? Now how to do that ??
>
> Your help is much appreciated !


--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Re: Unique Matched Rule ! [message #538796 is a reply to message #538767] Tue, 08 June 2010 16:13 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 523
Registered: July 2009
Senior Member
zoro wrote on Tue, 08 June 2010 11:18
Sylvain, Thanks for your reply, but that does not solve the problep, actually that way it creates 4 target elements instead of just 2 !

Any other idead is very welcome !

That's because you can invert s and t.
Let's say you have two Member A and B.
Then this rule will match s = A, t = B but also, s = B, t = A.

So if you use this solution you have to elaborate a complex filter so that you can't invert both elements if you don't want to.
Re: Unique Matched Rule ! [message #538814 is a reply to message #538796] Tue, 08 June 2010 17:22 Go to previous messageGo to next message
zoro  is currently offline zoro
Messages: 26
Registered: April 2010
Junior Member
@Sylvain: That will only lead to more and more complex filter as you said, and frankly, I don't have a clue how to write that filter, so if you have any other solution, I'll be greatful ...

@Vincent: I don't understant your idead, can you give me an example !

Thanks to all of you Smile

[Updated on: Tue, 08 June 2010 17:23]

Report message to a moderator

Re: Unique Matched Rule ! [message #538951 is a reply to message #538223] Wed, 09 June 2010 07:46 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 523
Registered: July 2009
Senior Member
You have to take in consideration that a unique called rule only consider the first argument for the unicity.

If you call the same rule with A, B and then B, A it will still execute the rule 2 times (except if this bug has been corrected).
Re: Unique Matched Rule ! [message #539063 is a reply to message #538223] Wed, 09 June 2010 14:21 Go to previous message
zoro  is currently offline zoro
Messages: 26
Registered: April 2010
Junior Member
No, this bug hasn't been corrected ! so I'm looking for a workaround (hopefully it exists !) ...
Previous Topic:[QVTo] 1-to-* transformation does only result in one deeper transformationtree
Next Topic:how to construct the defining feature in a slot (instance)
Goto Forum:
  


Current Time: Thu Oct 23 04:47:28 GMT 2014

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

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