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 17: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: [ATL] Re: Help with access stereotype by a class [message #78941 is a reply to message #78828] |
Fri, 11 April 2008 15:02   |
Eclipse User |
|
|
|
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: Sun Jun 08 21:46:14 EDT 2025
Powered by FUDForum. Page generated in 0.04952 seconds
|