Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Problems about queries(Problems with use of "select" in queries)
[Acceleo] Problems about queries [message #654822] Thu, 17 February 2011 10:05 Go to next message
Dulz is currently offline DulzFriend
Messages: 5
Registered: November 2010
Junior Member
Hi, sorry for my poor english, i have some problems about use of queries in Acceleo. First of all i put below the piece of my meta-model of interest.

Uploaded with

I would like to extract from the level Noun Phrase the field HeadString but according to the type of the level indicated in the picture as "Sentence Pattern". To do so i tried to use a query which uses the method select, can it be a useful solution? I need also to put the strings i catch into a Set(String) or OrderedSet (String), so as to not have duplicates. This is my sad solution:
[query public doppi(u:UseCase):OrderedSet(String)=
u.specification.eContents(BasicFlow).eContents(ConditionChec kSentence).eContents(SimpleSentence).
eContents(SentencePattern)-> select(name.contains('V-DO')).ancestors(SimpleSentence).eCon tents(Subject).
eContents(NounPhrase).headString.toUpperFirst()->select(oclIsKindOf(String))- >select(oclIsKindOf(String))/]
The problem is to select in a level but to extract from another level.
Thank you in advance for the help.
Re: [Acceleo] Problems about queries [message #655086 is a reply to message #654822] Fri, 18 February 2011 09:55 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Dulz,

>>"To do so i tried to use a query which uses the method select, can it be a useful solution?"
It is indeed a good solution but your query is definitely to complicated, you should split it in two or three and by doing so you could even prevent the need to "move down" in your model to "move back up" (with ancestor) just a bit later. If you need to be sure about the absence of duplicate don't hesitate to use a "asOrderedSet()' at the end.

Stephane Begaudeau, Obeo

Twitter: @sbegaudeau
Acceleo wiki:
Blogs: &
Previous Topic:[acceleo] Source context menu not showing up during Android Tutorial
Next Topic:[Acceleo] eliminate warnings
Goto Forum:

Current Time: Fri Dec 08 04:10:31 GMT 2023

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

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

Back to the top