Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » guery name
guery name [message #1785303] Thu, 12 April 2018 05:40 Go to next message
Eclipse UserFriend
hey,

I want to create a query that reads names from my UML model, I've tried to look for it in the internet but nothing helpful!
Does any one know the how can I do it?

thank u ^^

[Updated on: Thu, 12 April 2018 05:49] by Moderator

Re: guery name [message #1785304 is a reply to message #1785303] Thu, 12 April 2018 05:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I strongly recommend that you follow the Acceleo tutorials, read the documentation and examine the examples before asking more newbie questions that are far too vague to answer, but which appear to have trivial solutions.

Regards

Ed Willink
Re: guery name [message #1785305 is a reply to message #1785304] Thu, 12 April 2018 05:50 Go to previous messageGo to next message
Eclipse UserFriend
hey,

will do ^^''

regards
Re: guery name [message #1785316 is a reply to message #1785305] Thu, 12 April 2018 06:58 Go to previous messageGo to next message
Eclipse UserFriend
Hey,

So I've been reading about query
and this is what I managed to do :

[template public generate(m : Model)]
[comment @main/]
[file (m.name, false, 'UTF-8')]
import QtQuick 2.2
[for (b:uml::Class|m.eAllContents(Class))]
[if(self.eContents()->select(b | b.getName = 'Item'))]
[GenerateClass(b)/]
[/if]
[/for]
!
[/file]
[/template]

[query public getName (c:Class) :Set(Property) =
c.attribute->select(visibility = VisibilityKind::public)
/]

but I got that error :
Unrecongnized variable "getName"

I dont knw why it's not recognizing it :/ !
Re: guery name [message #1785343 is a reply to message #1785316] Thu, 12 April 2018 15:07 Go to previous messageGo to next message
Eclipse UserFriend
You have to access your attributes directly: b.name (like you did with m.name, isn't it?)
Re: guery name [message #1785375 is a reply to message #1785343] Fri, 13 April 2018 03:59 Go to previous message
Eclipse UserFriend
Hi

I suspect that "Unrecongnized variable "getName"" is the answer. getName is not a variable. Since you declared an Operation query, perhaps you meant "getName()"; operations are invoked with parentheses; just like Java and C and ....

Regards

Ed Willink
Previous Topic:How to get the location of the currently executing template in java wrapper
Next Topic:Save the text file generated in other project
Goto Forum:
  


Current Time: Mon Apr 28 13:07:31 EDT 2025

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

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

Back to the top