Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » SysML & ACCELEO
SysML & ACCELEO [message #1007255] Tue, 05 February 2013 04:39 Go to next message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member

I am defining a M2T transformation through Acceleo from an input SysML model defined via papyrus.
I am having some problem while trying to retrieve SysML stereotypes. For the sake of simplicity I just provide a simplified version of the whole transformation.


[module generate('http://www.eclipse.org/papyrus/0.7.0/SysML','http://www.eclipse.org/uml2/3.0.0/UML')]

[template public generateElement(model : Model)  post(trim())]
[comment @main/]
[file ('test.txt',false,'UTF-8')]
[for (c:Block|model.member->selectByType(Block))]
#[c.name/]#
[/for]
[for (c:Class|model.member->selectByType(Class))]
[c.name/] [c.oclIsKindOf(Block)/] [c.oclAsType(Block).base_Class.name/] [c.getAppliedStereotype('SysML::Blocks::Block')->notEmpty()/]
[/for]
[/file]
[/template]


The only output I get for a test model containing just one Block named Block1 is

Block1 false invalid true


which means the Block is not recognized to be an instance of the Block meta-class (see the first for)
it is instead recognized as a stereotyped class.

However I do remember the first for worked in previos Papyrus/Acceleo versions.
Am I doing something wrong?

regards


Follow me on Twitter @andreasindico

[Updated on: Tue, 05 February 2013 05:35]

Report message to a moderator

Re: SysML & ACCELEO [message #1007299 is a reply to message #1007255] Tue, 05 February 2013 07:43 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille Letavernier
Messages: 421
Registered: February 2011
Senior Member
Hello Andrea,


From the Ecore point of view, a Block simply contains a reference to its base Element (base_Class). There is absolutely no inheritance relationship, it is a reference. And the UML Element contains a few methods to retrieve the applied stereotypes.

Papyrus and UML do not provide any further support. So, basically:

- A Block is not a Class
- A Class cannot be cast to a Block

You can still retrieve the Block object with "c.getStereotypeApplication('SysML::Blocks::Block')"

The same goes for all Stereotypes in all profiles.

If Acceleo provides (or used to provide, or is supposed to...) a specific support for UML Profiles, you will probably find more information directly on their forum.


Regards,
Camille
Re: SysML & ACCELEO [message #1007302 is a reply to message #1007299] Tue, 05 February 2013 08:02 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member

thank you Camille I did not know the getStereotypeApplication operation.


Follow me on Twitter @andreasindico

Re: SysML & ACCELEO [message #1007303 is a reply to message #1007302] Tue, 05 February 2013 08:06 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille Letavernier
Messages: 421
Registered: February 2011
Senior Member
Andrea,


The actual operation is Element.getStereotypeApplication(Stereotype), which means you'll probably need to write something like that:

c.getStereotypeApplication(c.getAppliedStereotype('SysML::Blocks::Block'))


Regards,
Camille
Re: SysML & ACCELEO [message #1007307 is a reply to message #1007303] Tue, 05 February 2013 08:29 Go to previous message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member

yes it is exactly what I am doing though quite annoying. I am going to wrap it in a dedicated query.

Regards,
Andrea


Follow me on Twitter @andreasindico

Previous Topic:StateMachine local vs. external transition
Next Topic:SOUTH_EAST decoration presented in wrong corner
Goto Forum:
  


Current Time: Wed Jul 30 21:30:27 EDT 2014

Powered by FUDForum. Page generated in 0.02086 seconds