Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Calling queries from mtl file
Calling queries from mtl file [message #1405658] Thu, 07 August 2014 22:37 Go to next message
Arunkumar Ramaswamy is currently offline Arunkumar RamaswamyFriend
Messages: 57
Registered: April 2014
Member
I would to know how can i call queries defined in .mtl file.
I read from documentation that this can be done, but i did not understand the below lines in documentation.

If you want to use queries from .mtl files in you Sirius project, the parent Viewpoint element must have a Java Extension element which references the MTL file, using the com::example::domain::design::module syntax.

I am trying to execute a acceleo block, ie i want to use FOR and IF statements to return a collection of model elements for a query, Is there is any better way to write such queries blocks other than in external mtl files?

Any help much appreciated
Arun

[Updated on: Thu, 07 August 2014 22:38]

Report message to a moderator

Re: Calling queries from mtl file [message #1405932 is a reply to message #1405658] Fri, 08 August 2014 14:31 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 522
Registered: July 2009
Senior Member
Le 08/08/2014 00:37, Arunkumar Ramaswamy a écrit :
> I would to know how can i call queries defined in .mtl file.
> I read from documentation that this can be done, but i did not
> understand the below lines in documentation.
>
> If you want to use queries from .mtl files in you Sirius project, the
> parent Viewpoint element must have a Java Extension element which
> references the MTL file, using the com::example::domain::design::module
> syntax.

You must create your MTL file inside the modeler project, define your
MTL queries inside, and then register the file in the VSM model as
described above in the doc. Make sure the project has the Acceleo nature
so that the Acceleo builder will compile the .mtl.

If you put your queries in a file located in
src/com/example/domain/design/module.mtl inside your project the
"Qualified class name" to user for you extension will be
com::example::domain::design::module.

Don't worry about the "Java extension" name; it is misleading (and
should be modified), but will work for MTL modules too.

I've attached a very basic example of this which delegates the label
computation to a query defined in a .mtl file.

> I am trying to execute a acceleo block, ie i wannt to use for and if
> statements to return a collection of model elements for a query, Is
> there is any better way to write such queries blocks other than in
> external mtl files?

It is possible to write complex Acceleo queries directly inside the VSM
in the "interpreted expression" text fields. Not very convenient for
longer expressions but possible.

If the logic becomes too complex, it is also possible to write it in a
Java "service method" and call it from the VSM (see the documentation
for the details).

--
Pierre-Charles David - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Element based edge source and target problem
Next Topic:Dynamic creation of tool
Goto Forum:
  


Current Time: Tue Mar 31 02:48:19 GMT 2020

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

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

Back to the top