Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3] getting All classes from Papyrus Model([Acceleo 3] getting All classes from Papyrus Model strarting from a given class property)
[Acceleo 3] getting All classes from Papyrus Model [message #646930] Mon, 03 January 2011 09:08 Go to next message
splogad  is currently offline splogad
Messages: 2
Registered: June 2010
Junior Member
Hi to everybody!
I'm dealing with an Acceleo 3 template to generate c# code. The problem is that starting from a Papyrus UML model I would like to retrieve all classes that belong to such model.

My template simply write a file for each class but sometimes given a class it has to find for each of other class of the model if a given property is set. I tried to select classes form getModel() method but it didn't work:
"[(c.getModel().eAllContents(Class)->select(
classLoop: Class | general->asSequence()->last().qualifiedName = c.qualifiedName))->collect(qualifiedName)/] "
I tried also with different selection, but it seems that model doesn't contain classes.

Is it possible to do that? please send me a feedback.

thanks in advance
giacomo

Re: [Acceleo 3] getting All classes from Papyrus Model [message #647229 is a reply to message #646930] Wed, 05 January 2011 08:38 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040100080406000008030107
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Giacomo,

This isn't a Papyrus problem, rather a general UML question. However, I
don't see what you're trying to do at all. You say you want to retrieve
all classes, but the OCL query you show doesn't select "all" classes :
it only retrieve one single classes which is the one you started with
(the class contained in variable "c").

"all classes" can be done in a number of ways, here are the two easiest :

1 - [Class.AllInstances/]
2 - [c.getModel().eAllContents(Class)/]

You had the "2", however, the "select" you did afterwards was merely
narrowing down the Classes you retrieved to "c" alone.

Laurent Goubet
Obeo

On 03/01/2011 10:08, splogad wrote:
> Hi to everybody!
> I'm dealing with an Acceleo 3 template to generate c# code. The problem
> is that starting from a Papyrus UML model I would like to retrieve all
> classes that belong to such model.
>
> My template simply write a file for each class but sometimes given a
> class it has to find for each of other class of the model if a given
> property is set. I tried to select classes form getModel() method but it
> didn't work:
> "[(c.getModel().eAllContents(Class)->select( classLoop: Class |
> general->asSequence()->last().qualifiedName =
> c.qualifiedName))->collect(qualifiedName)/] "
> I tried also with different selection, but it seems that model doesn't
> contain classes.
>
> Is it possible to do that? please send me a feedback.
>
> thanks in advance
> giacomo
>
>


--------------040100080406000008030107
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------040100080406000008030107--
Previous Topic:[Xpand] setting the value of a global variable from xtend?
Next Topic:Using getValue(Stereotype, String) with Collections
Goto Forum:
  


Current Time: Wed Oct 22 05:08:21 GMT 2014

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

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