Home » Archived » M2M (model-to-model transformation) » Help with access stereotype by a class
Help with access stereotype by a class [message #78239] |
Thu, 03 April 2008 21:32 |
Eclipse User |
|
|
|
Originally posted by: narciso.martins.yahoo.com.br
Hi, I need help again, this time i try transform a Model conforms to UML
in onther Model conforms to UML, changing only the the name os class and
your stereotype, but the name to chande is conform the stereotype and i
dont know how access it, this is my atl code:
module CIM2PIM; -- Module Template
create OUT : UML refining IN : UML;
helper context UML!Stereotype def: isBusiness() : Boolean =
if (self.name = 'Business Process') then
true
else
false
endif;
helper context UML!Stereotype def: isActivity() : Boolean =
if (self.name = 'Activity') then
true
else
false
endif;
rule Model
{
from s : UML!Model
to t : UML!Model (
name <- s.name,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
ownedElement <- s.ownedElement
)
}
rule BusinessProcess2Interface
{
from s : UML!Stereotype (s.isBusiness())
to t : UML!Stereotype (
name <- 'Interface',
visibility <- s.visibility,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
baseClass <- s.baseClass
)
}
rule Activity2OperationPort
{
from s : UML!Stereotype (s.isActivity())
to t : UML!Stereotype (
name <- 'Operation Port',
visibility <- s.visibility,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
baseClass <- s.baseClass
)
}
rule stereotypeA
{
from s : UML!Class(s.stereotype = 'Activity')
to t : UML!Class (
name <- s.name ,
visibility <- s.visibility,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
isActive <- s.isActive,
stereotype <- s.stereotype
)
}
rule stereotypeB
{
from s : UML!Class (s.stereotype = 'Businees Process')
to t : UML!Class (
name <- s.name + '_SERVICO',
visibility <- s.visibility,
visibility <- s.visibility,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
isActive <- s.isActive,
stereotype <- s.stereotype
)
}
The problem "s.stereotype" this is not the correct way to access the
stereotype, please help.
Best regards,
Narciso Martins
|
|
|
Re: Help with access stereotype by a class [message #78686 is a reply to message #78239] |
Thu, 10 April 2008 19:14 |
Eclipse User |
|
|
|
Originally posted by: ryan.bertin.gmail.com
Hi think i have the same problem, could someone help? I am studing OCL,
but i still dont know how use reference. Hope someone help, and if you
already discovery how to do, please post here. Advanced regards,
Aubertin, Ryan.
|
|
| |
Re: [ATL] Re: Help with access stereotype by a class [message #78934 is a reply to message #78828] |
Fri, 11 April 2008 18:30 |
Eclipse User |
|
|
|
Originally posted by: narciso.martins.yahoo.com.br
Hi, sorry for didnt use [ATL], and thx to help me,
i still having a problem, i am using a xmi model imported from Poseidon,
and using as metamodel the UMLDI.xmi (diagram interchange), and using
model handler: MDR. Is this helper valid on my context?
Advanced Regards,
Narciso Martins.
|
|
|
Re: [ATL] Re: Help with access stereotype by a class [message #78941 is a reply to message #78828] |
Fri, 11 April 2008 19:02 |
Leandro Messages: 20 Registered: July 2009 |
Junior Member |
|
|
Hello friends,
I'm with the same problem. Is it possible, using the helper posted by
William, to access stereotype in xmi models, using UMLDI as metamodel and
MDR model handler? Thank you in advance.
The ATL code is:
module CIM2PIM;
create OUT : UML refining IN : UML;
helper context UML!Class def: hasStereotype(stereotype :
String) : Boolean =
self.getAppliedStereotypes() -> collect(st | st.name) ->
includes(stereotype);
helper context UML!Stereotype def: isActivity() : Boolean =
if (self.name = 'Activity') then
true
else
false
endif;
rule Model {
from s : UML!Model
to t : UML!Model (
name <- s.name,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
ownedElement <- s.ownedElement
)
}
rule Activity2OperationPort {
from s : UML!Stereotype (s.isActivity())
to t : UML!Stereotype (
name <- 'Operation Port',
visibility <- s.visibility,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
baseClass <- s.baseClass
)
}
rule Class {
from s : UML!Class (s.hasStereotype('Operation Port'))
to t : UML!Class (
name <- s.name + '_OP',
visibility <- s.visibility,
isSpecification <- s.isSpecification,
isRoot <- s.isRoot,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
isActive <- s.isActive,
stereotype <- s.stereotype
)
}
|
|
| | |
Goto Forum:
Current Time: Wed Sep 25 05:27:01 GMT 2024
Powered by FUDForum. Page generated in 0.04338 seconds
|