Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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.
[ATL] Re: Help with access stereotype by a class [message #78828 is a reply to message #78239] Fri, 11 April 2008 06:49 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070105090802060900050007
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

Please remember to prefix your subject with [ATL], thanks.

The "stereotype" reference doesn't exist in UML2, so you need to call
natives UML2 API methods, for instance getAppliedStereotypes().

Here is an helper which probably will help you :
helper context UML!"uml::Element" def: hasStereotype(stereotype :
String) : Boolean =
self.getAppliedStereotypes() -> collect(st | st.name) ->
includes(stereotype);

Regards,

William

Narciso a
Re: [ATL] Re: Help with access stereotype by a class [message #78934 is a reply to message #78828] Fri, 11 April 2008 18:30 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Leandro is currently offline LeandroFriend
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
)
}
Re: [ATL] Re: Help with access stereotype by a class [message #78973 is a reply to message #78941] Mon, 14 April 2008 07:33 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020805070403040609020902
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

The helper I put here works for Eclipse UML2 models, because the UML2
api provide the getAppliedStereotypes method.

The way to access to stereotypes strongly depends on your UML metamodel,
so you need to look at it. For instance I know that in UML1.4 there
was a 'stereotype' attribute in UML Elements.

Regards

William

Nogueira a
Re: [ATL] Re: Help with access stereotype by a class [message #79129 is a reply to message #78973] Tue, 15 April 2008 00:40 Go to previous message
Leandro is currently offline LeandroFriend
Messages: 20
Registered: July 2009
Junior Member
Hello,

I've got the stereotype with:

... from c : UML!Class (c.stereotype -> exists (s | s.name = 'Activity')
...

Thank's for all replies!

Regards,

Nogueira.
Previous Topic:[ATL] Full reference to a metamodel class
Next Topic:ATL installation problem
Goto Forum:
  


Current Time: Thu Nov 21 15:53:59 GMT 2019

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

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

Back to the top