Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » guery name
guery name [message #1785303] Thu, 12 April 2018 09:40 Go to next message
khouloud AYARI is currently offline khouloud AYARIFriend
Messages: 49
Registered: March 2018
Member
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 09:49]

Report message to a moderator

Re: guery name [message #1785304 is a reply to message #1785303] Thu, 12 April 2018 09:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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 09:50 Go to previous messageGo to next message
khouloud AYARI is currently offline khouloud AYARIFriend
Messages: 49
Registered: March 2018
Member
hey,

will do ^^''

regards
Re: guery name [message #1785316 is a reply to message #1785305] Thu, 12 April 2018 10:58 Go to previous messageGo to next message
khouloud AYARI is currently offline khouloud AYARIFriend
Messages: 49
Registered: March 2018
Member
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 19:07 Go to previous messageGo to next message
louis andia. is currently offline louis andia.Friend
Messages: 47
Registered: November 2016
Member
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 07:59 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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: Sat Apr 20 02:57:55 GMT 2024

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

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

Back to the top