Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problem with UML property
[ATL] Problem with UML property [message #548631] Thu, 22 July 2010 14:12 Go to next message
Bler  is currently offline Bler Friend
Messages: 26
Registered: June 2010
Junior Member
Hi there,

I tray anxiously to refractor an uml class diagram as follow:
- I have to ignore (remove) a property for 2 sub-classes
- I have to create a new property into the super-class.

For this I do the following implementation:

create OUT : UML refining IN : UML;

helper def: getClass(s:String) : UML!Class =
UML!Class.allInstances()-> select(c | c.name = s).first();


helper context UML!Class def: getProperties() : Sequence(UML!Property) =
if self.ownedAttribute.size() > 0 then
self.ownedAttribute -> select(p | p.name <> 'IDb' and p.name <>'IDc')-> asSequence()
else
Sequence{}
endif;

rule parent2parent {

from classS:UML!Class (classS.name = 'Person')

to classT:UML!Class
(
name <- classS.name,
ownedAttribute <- addNewProperty,
ownedAttribute <- classS.ownedAttribute,
ownedOperation <- classS.ownedOperation
),
addNewProperty: UML!Property
(
name <-'matricule',
type <- thisModule.getClass('Number')
)
}

rule childs2childs
{
from classS:UML!Class (classS.name <> 'Person')
to classT:UML!Class
(
name <- classS.name,
ownedAttribute <- classS.getProperties()
)
}


The super-classe is ok, but the 2 properties in the sub-classes respectively are not ignored, I do not understand why, anyone could help me please, how we can do it?

With regards,
Bler

NB: You can write in French too.
Re: [ATL] Problem with UML property [message #548637 is a reply to message #548631] Thu, 22 July 2010 14:26 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 22/07/2010 16:12, Bler a écrit :
> Hi there,
>
> I tray anxiously to refractor an uml class diagram as follow:
> - I have to ignore (remove) a property for 2 sub-classes
> - I have to create a new property into the super-class.
>
> For this I do the following implementation:
>
> create OUT : UML refining IN : UML;
>
> helper def: getClass(s:String) : UML!Class =
> UML!Class.allInstances()-> select(c | c.name = s).first();
>
>
> helper context UML!Class def: getProperties() : Sequence(UML!Property) =
> if self.ownedAttribute.size() > 0 then
> self.ownedAttribute -> select(p | p.name <> 'IDb' and p.name <>'IDc')->
> asSequence()
> else
> Sequence{}
> endif;
>
> rule parent2parent {
>
> from classS:UML!Class (classS.name = 'Person')
>
> to classT:UML!Class (
> name <- classS.name,
> ownedAttribute <- addNewProperty,
> ownedAttribute <- classS.ownedAttribute,
> ownedOperation <- classS.ownedOperation
> ),
> addNewProperty: UML!Property
> (
> name <-'matricule',
> type <- thisModule.getClass('Number')
> )
> }
>
> rule childs2childs {
> from classS:UML!Class (classS.name <> 'Person')
> to classT:UML!Class
> ( name <- classS.name,
> ownedAttribute <- classS.getProperties()
> )
> }
>
>
> The super-classe is ok, but the 2 properties in the sub-classes
> respectively are not ignored, I do not understand why, anyone could help
> me please, how we can do it?
> With regards,
> Bler
>
> NB: You can write in French too.
>

I do not remember the details of UML but are you sure that
ownedAttribute contains what you expect it contains?? Could
ownedAttribute elements be link to a Property in place of a Property???
--
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: [ATL] Problem with UML property [message #548639 is a reply to message #548631] Thu, 22 July 2010 14:36 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You can't remove elements in refining mode yet.
Re: [ATL] Problem with UML property [message #548653 is a reply to message #548637] Thu, 22 July 2010 14:59 Go to previous messageGo to next message
Bler  is currently offline Bler Friend
Messages: 26
Registered: June 2010
Junior Member
Hi Vincent,

Thanks a lot for your help !! Smile

I debugged it and the ownedAttribute contains only the desired properties(selected by the helper) during the execution...
I 'm not sure but I think attribute and Property are the same...

Cordialement et merci encore,
Bler

Re: [ATL] Problem with UML property [message #548656 is a reply to message #548639] Thu, 22 July 2010 15:05 Go to previous messageGo to next message
Bler  is currently offline Bler Friend
Messages: 26
Registered: June 2010
Junior Member
Hi Sylvain,

I will change it right now into normal ("from") mode I suppose...

Regards and thank you so much for your help Smile
Bler
Re: [ATL] Problem with UML property [message #548663 is a reply to message #548656] Thu, 22 July 2010 15:08 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Bler wrote on Thu, 22 July 2010 11:05
Hi Sylvain,

I will change it right now into normal ("from") mode I suppose...

Regards and thank you so much for your help Smile
Bler


If you switch to normal mode, you have to copy everything you want to transform. Usually the best is to use UML2Copy.atl that copies all the UML2 elements, and super-impose that with your own rules.
Re: [ATL] Problem with UML property [message #548665 is a reply to message #548663] Thu, 22 July 2010 15:25 Go to previous messageGo to next message
Bler  is currently offline Bler Friend
Messages: 26
Registered: June 2010
Junior Member
Hi Sylvain,

I'm new to ATL, is it an external file/lib, where can I found it, or how can I use it please?

A lot of thanks,
bler
Re: [ATL] Problem with UML property [message #548698 is a reply to message #548631] Thu, 22 July 2010 16:52 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You can find that here or generate it using that
Previous Topic:Possibility to have several levels in an XMI File?
Next Topic:Call helper inside a rule and overgive parameter
Goto Forum:
  


Current Time: Fri Apr 16 12:41:28 GMT 2021

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

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

Back to the top