Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] query problem
[Acceleo] query problem [message #1406995] Mon, 11 August 2014 16:12 Go to next message
Arunkumar Ramaswamy is currently offline Arunkumar RamaswamyFriend
Messages: 57
Registered: April 2014
Member
I have a metamodel as below
System
|_Component (attributes: name(string)

I am confused how to write a query that returns a collection of Components whose name = "xxx".

The below query returns all the component elements of System, but i need only that has a particular name.
how can I use FOR/IF loops inside query?

[query public getComp (aSystem : System) : Collection(Component) =
aSystem.eGet('component')
/]


Any help much appreciated.
Arun
Re: [Acceleo] query problem [message #1407026 is a reply to message #1406995] Mon, 11 August 2014 17:50 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7265
Registered: July 2009
Senior Member
HI

IN Acceleo you are using a powerful modeling tool, so forget about any
Java API that you may have used in the past. In particular eGet is a bit
mistake.

Not sure what uyou really want but something like

someComponents->select(c | c.name = 'xxx')

might do as part of the caller; no real need to wrap it up as a query.

Regards

Ed Willink


On 11/08/2014 17:12, Arunkumar Ramaswamy wrote:
> I have a metamodel as below
> System
> |_Component (attributes: name(string)
>
> I am confused how to write a query that returns a collection of
> Components whose name = "xxx".
>
> The below query returns all the component elements of System, but i
> need only that has a particular name.
> how can I use FOR/IF loops inside query?
>
> [query public getComp (aSystem : System) : Collection(Component) =
> aSystem.eGet('component')
> /]
>
>
> Any help much appreciated.
> Arun
Previous Topic:[Xpand] Extension: class is not responsible for java type
Next Topic:[Acceleo] Variables in Acceleo
Goto Forum:
  


Current Time: Mon Sep 20 12:25:34 GMT 2021

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

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

Back to the top