[ATL] Problem with UML property [message #548631] |
Thu, 22 July 2010 14:12 |
Bler 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 |
Vincent MAHE 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
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04465 seconds