Home » Eclipse Projects » Sirius » AQL expression for setname() in Sirius
|
Re: AQL expression for setname() in Sirius [message #1712597 is a reply to message #1712594] |
Mon, 26 October 2015 16:57 |
|
Le 26/10/2015 17:37, Parsa Pourali a écrit :
> Hi everyone,
>
Hi,
> Not sure if this is the right place to ask this question, but I'll take my chance!
>
Yes, it is the right place.
> The question is about using aql (Acceleo Query Language) in Sirius. I have meta-model for a simple fsm (as attached in this post ).
>
> I am trying to auto-increment the label of a NormalState when I create in on the canvas. My setname() query is:
> aql: 'S'+container.states->filter(container.states::NormalState)->size()
>
> I don't see why it doesn't work! However when I use the following query, it works!
> aql: 'S'+container.states->size()
>
I don't think that "container.states" is the nsPrefix of your EPackage
of your meta-model (name of the containing EPacakge of EClass).
I think that the expression should be something like
aql:'S'+container.states->filter(fsm::NormalState)->size()
> The thing is that there are three types of states: Initial,Final and Normal states. I want to count the Normal States and not include initial and final states in the size/count.
>
> Thanks,
> Parsa
>
Regards,
--
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: AQL expression for setname() in Sirius [message #1712649 is a reply to message #1712613] |
Tue, 27 October 2015 08:03 |
|
Le 26/10/2015 19:37, Parsa Pourali a écrit :
> Thanks Laurent for your answer,
>
> Actually I pasted a wrong query. what I meant was exactly what you
> suggested, which is:
> aql:'S'+container.states->filter(fsm::NormalState)->size()
>
> I am confused, it should work but it doesn't. It does not set the name
> at all, as if the query can't be even compiled !
>
> No idea why ! It seems to me a straight forward query that should work
> :( When I remove the filter part it works, but when I filter it doesn't :(
>
> confused ...
> Any suggestion will be appreciated...
Do you try a similar expression directly in the Interpreter view [1]?
The starting point should be something like:
* aql:self.target.oclAsType(fsm::StateMachine).states->size()
*
aql:self.target.oclAsType(fsm::StateMachine).states->filter(fsm::NormalState)->size()
* aql:self.target.oclAsType(fsm::StateMachine).states->select(i |
i.oclIsKindOf(fsm::NormalState))->size()
> Thanks,
> Bests,
> Parsa
[1]
https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#general
--
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: AQL expression for setname() in Sirius [message #1712718 is a reply to message #1712715] |
Tue, 27 October 2015 16:09 |
|
Le 27/10/2015 16:34, Parsa Pourali a écrit :
> Hi Laurent,
>
Hi,
> Thanks for your suggested queries :)
> Still it didn't work ! That is weird! All the queries you sent are
> straight forward and it should work easily! I don't know why it is so :(
> do you think somewhere in my metamodel might be wrong ?
>
I don't know.
Could you precise the errors that the interpreter view gives for each
expression?
Which version of Sirius and AQL did you used? Have you try with the latest?
> The funny part is that, even if the filter method cannot find anymatch
> for fsm::NormalState, the size should return 0 such as 'S'+0 ! But, the
> query doesn't work at all ...
> The only solution that remains to me is I guess separating initial and
> final states into another set such as init_fin_states and only keep
> NormalStates in states. :( because the query works without filter, so I
> need to separate them in my meta-model ...
>
> Thanks,
> Parsa
>
--
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: AQL expression for setname() in Sirius [message #1712764 is a reply to message #1712732] |
Wed, 28 October 2015 07:36 |
Axel Guckelsberger Messages: 354 Registered: July 2009 |
Senior Member |
|
|
Hi all,
I am experiencing AQL-related problems as well. Maybe it is related to
the version of the Acceleo bundles used.
The org.eclipse.sirius.common.acceleo.aql bundle specifies the following
imports:
Import-Package: org.eclipse.acceleo.query.runtime;version="[3.6.0,4.0.0)",
org.eclipse.acceleo.query.validation.type;version="[3.6.0,4.0.0)"
Note that this is exclusive 4.0.0. The newer update sites from Acceleo
provide the 4.0.0 version of the Query features though.
I noticed that first in my Jenkins build (assembled by Buckminster)
where the following error occured:
[ant] Missing requirement: Sirius Support for AQL Expressions
3.1.0.201510150803 (org.eclipse.sirius.common.acceleo.aql
3.1.0.201510150803) requires 'package org.eclipse.acceleo.query.runtime
[3.6.0,4.0.0)' but it could not be found
As a temporary workaround I added the following update site to make the
3.6.x version available again:
http://download.eclipse.org/acceleo/updates/releases/3.6/R201506080954
A much better solution would be raising the import version range of
course and ensuring Sirius AQL integration works with Query SDK 4.0.0.
Axel
Am 27.10.2015 um 19:13 schrieb Parsa Pourali:
> From what I can see here,
> the version of Sirius is 3.1.0.201510150803
> Acceleo 3.6.2.201510121214
> Acceleo Query SDK 4.0.0.201510121214
> Also my Eclipse is Mars.
>
> It does not produce any error :( like if I write a wrong query, I will
> see an error message and the Node (state) will not be placed in the
> diagram canvas. But when I use this filter query, it gives no error and
> places the node in the Canvas. However, the node that is places will not
> show the label. Note that the label will be shown if I use any other
> query and there is no problem with setting label attributes.
>
> Thanks,
> Parsa
|
|
|
Re: AQL expression for setname() in Sirius [message #1712775 is a reply to message #1712764] |
Wed, 28 October 2015 08:19 |
|
Le 28/10/2015 08:36, Axel Guckelsberger a écrit :
> Hi all,
>
> I am experiencing AQL-related problems as well. Maybe it is related to
> the version of the Acceleo bundles used.
>
> The org.eclipse.sirius.common.acceleo.aql bundle specifies the following
> imports:
>
> Import-Package: org.eclipse.acceleo.query.runtime;version="[3.6.0,4.0.0)",
> org.eclipse.acceleo.query.validation.type;version="[3.6.0,4.0.0)"
The org.eclipse.acceleo.query bundle has a 4.0.0 version but note that
it exports the org.eclipse.acceleo.query.runtime and the
org.eclipse.acceleo.query.validation.type are exported with version="3.6.0".
>
> Note that this is exclusive 4.0.0. The newer update sites from Acceleo
> provide the 4.0.0 version of the Query features though.
>
> I noticed that first in my Jenkins build (assembled by Buckminster)
> where the following error occured:
>
> [ant] Missing requirement: Sirius Support for AQL Expressions
> 3.1.0.201510150803 (org.eclipse.sirius.common.acceleo.aql
> 3.1.0.201510150803) requires 'package org.eclipse.acceleo.query.runtime
> [3.6.0,4.0.0)' but it could not be found
>
> As a temporary workaround I added the following update site to make the
> 3.6.x version available again:
>
> http://download.eclipse.org/acceleo/updates/releases/3.6/R201506080954
You can find the different update sites of Sirius in [1], but also the
target platforms used to build the different version. For Sirius 3.1,
the update site can be found un [2], the target platform in [3] with its
aql module in [3].
We currently use the following Acceleo/AQL release:
http://download.eclipse.org/acceleo/updates/milestones/3.6/S201510121214
>
> A much better solution would be raising the import version range of
> course and ensuring Sirius AQL integration works with Query SDK 4.0.0.
>
> Axel
>
>
> Am 27.10.2015 um 19:13 schrieb Parsa Pourali:
>> From what I can see here,
>> the version of Sirius is 3.1.0.201510150803
>> Acceleo 3.6.2.201510121214
>> Acceleo Query SDK 4.0.0.201510121214
>> Also my Eclipse is Mars.
>>
>> It does not produce any error :( like if I write a wrong query, I will
>> see an error message and the Node (state) will not be placed in the
>> diagram canvas. But when I use this filter query, it gives no error and
>> places the node in the Canvas. However, the node that is places will not
>> show the label. Note that the label will be shown if I use any other
>> query and there is no problem with setting label attributes.
>>
>> Thanks,
>> Parsa
>
Regards
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1]
http://download.eclipse.org/sirius/updates/releases/3.1.0/mars/targets/modules/acceleo-3.6.tpd
[2] http://download.eclipse.org/sirius/updates/releases/3.1.0/mars
[3] http://download.eclipse.org/sirius/updates/releases/3.1.0/mars/targets/
[4]
http://download.eclipse.org/sirius/updates/releases/3.1.0/mars/targets/modules/acceleo-3.6.tpd
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: AQL expression for setname() in Sirius [message #1712782 is a reply to message #1712732] |
Wed, 28 October 2015 08:49 |
|
Le 27/10/2015 19:13, Parsa Pourali a écrit :
> From what I can see here,
> the version of Sirius is 3.1.0.201510150803
> Acceleo 3.6.2.201510121214
> Acceleo Query SDK 4.0.0.201510121214
> Also my Eclipse is Mars.
>
> It does not produce any error :( like if I write a wrong query, I will
> see an error message and the Node (state) will not be placed in the
> diagram canvas. But when I use this filter query, it gives no error and
> places the node in the Canvas. However, the node that is places will not
> show the label. Note that the label will be shown if I use any other
> query and there is no problem with setting label attributes.
>
> Thanks,
> Parsa
Did you try your queries from the Interpreter View (with Sirius
interpreter selected and not the Acceleo Interpreter) ?
You can evaluate your queries on any EObject selection:
. If you open your model with EMF default tree editor: you will
evaluate in a default context: if you select a StateMachine, self is the
selected StateMachine, you can try :
aql:self.states->filter(fsm::NormalState)->size()
. If you evaluate an expression with a Sirius diagram element
selected, the evaluation will be done with the same context than the
evaluation of the queries you specified in your odesign file. But you
will need to modify your query (compared to the previous point) because
the selected element is not your semantic element but an element of the
Sirius internal model so you first have to navigate to your semantic
element and then continue your query:
aql:self.target.oclAsType.(fsm::StateMachine).states->filter(fsm::NormalState)->size()
or aql:self.oclAsType(viewpoint::DSemanticDecorator).target. (end of
your query)
In your VSM, aql:'S'+container.states->filter(fsm::NormalState)->size()
should work (it is very close from the tool sample in the starter
tutorial [1]).
Could you try/check the following configurations:
. Make your VSM plugin depends on your metamodel plugins
. In your the Viewpoint Specification Editor, on your
Diagram/Tree/Table description, select the Metamodels tab in the
properties view and add your metamodel. This should help aql for the
completion and validation.
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
---
[1]
https://wiki.eclipse.org/Sirius/Tutorials/StarterTutorial#Define_the_actions_performed_by_the_Create_Node_tool
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: AQL expression for setname() in Sirius [message #1712830 is a reply to message #1712782] |
Wed, 28 October 2015 15:20 |
|
Hi Parsa and Axel,
I am currently working on Bug 479726 [1] which seems to correspond to
your situation.
The simplest solution to your issue is to add a dependency to your
metamodel plugin(s) in the MANIFEST.MF of your Viewpoint Specification
Project. This will allow the AQL interpreter to retrieve your metamodels
during the evaluation of the type literals (like fsm::NormalState).
Furthermore, this will make your modeler plugin non installable if your
domain plugins are not present.
The second idea I proposed this morning also works but only if you use
the "Add from registry" button to reference your metamodel for each
representation description (implies to develop the VSM with the
metamodel deployed). This make the dependency to the metamodel plugin(s)
optional (until you write Java services without importing required
packages in the MANIFEST.MF).
Sirius 3.1.1 is expected to be released soon, Bug 479726 will be
resolved for this version but the correction will only consist in
Documentation, Tutorial and Release Notes updates and a new bugzilla
will be created to think about a proper enhancement of the situation.
Regards
Le 28/10/2015 09:49, Maxime Porhel a écrit :
> Le 27/10/2015 19:13, Parsa Pourali a écrit :
>> From what I can see here,
>> the version of Sirius is 3.1.0.201510150803
>> Acceleo 3.6.2.201510121214
>> Acceleo Query SDK 4.0.0.201510121214
>> Also my Eclipse is Mars.
>>
>
> Could you try/check the following configurations:
> . Make your VSM plugin depends on your metamodel plugins
> . In your the Viewpoint Specification Editor, on your
> Diagram/Tree/Table description, select the Metamodels tab in the
> properties view and add your metamodel. This should help aql for the
> completion and validation.
>
>
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=479726
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: AQL expression for setname() in Sirius [message #1712866 is a reply to message #1712830] |
Wed, 28 October 2015 23:12 |
Parsa Pourali Messages: 210 Registered: February 2014 |
Senior Member |
|
|
Hi Maxime,
Thank you so much for your helpful comments.
As I'm not really expert in these dependency stuffs, may I ask how can I add a dependency to mty metamodel plugin(s) in the MANIFEST.MF of my Viewpoint Specification Project?
right now my manifest.mf looks like following:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: fsm.design
Bundle-SymbolicName: fsm.design;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: fsm.design.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.sirius,
org.eclipse.sirius.common.acceleo.aql
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
What should I add to it ?
Thanks a lot
Bests,
Parsa
Maxime Porhel wrote on Wed, 28 October 2015 11:20Hi Parsa and Axel,
I am currently working on Bug 479726 [1] which seems to correspond to
your situation.
The simplest solution to your issue is to add a dependency to your
metamodel plugin(s) in the MANIFEST.MF of your Viewpoint Specification
Project. This will allow the AQL interpreter to retrieve your metamodels
during the evaluation of the type literals (like fsm::NormalState).
Furthermore, this will make your modeler plugin non installable if your
domain plugins are not present.
The second idea I proposed this morning also works but only if you use
the "Add from registry" button to reference your metamodel for each
representation description (implies to develop the VSM with the
metamodel deployed). This make the dependency to the metamodel plugin(s)
optional (until you write Java services without importing required
packages in the MANIFEST.MF).
Sirius 3.1.1 is expected to be released soon, Bug 479726 will be
resolved for this version but the correction will only consist in
Documentation, Tutorial and Release Notes updates and a new bugzilla
will be created to think about a proper enhancement of the situation.
Regards
Le 28/10/2015 09:49, Maxime Porhel a écrit :
> Le 27/10/2015 19:13, Parsa Pourali a écrit :
>> From what I can see here,
>> the version of Sirius is 3.1.0.201510150803
>> Acceleo 3.6.2.201510121214
>> Acceleo Query SDK 4.0.0.201510121214
>> Also my Eclipse is Mars.
>>
>
> Could you try/check the following configurations:
> . Make your VSM plugin depends on your metamodel plugins
> . In your the Viewpoint Specification Editor, on your
> Diagram/Tree/Table description, select the Metamodels tab in the
> properties view and add your metamodel. This should help aql for the
> completion and validation.
>
>
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=479726
|
|
|
Re: AQL expression for setname() in Sirius [message #1712914 is a reply to message #1712866] |
Thu, 29 October 2015 10:23 |
|
Hi Parsa,
Le 29/10/2015 00:12, Parsa Pourali a écrit :
> Hi Maxime,
>
> Thank you so much for your helpful comments.
> As I'm not really expert in these dependency stuffs, may I ask how can I
> add a dependency to mty metamodel plugin(s) in the MANIFEST.MF of my
> Viewpoint Specification Project?
> right now my manifest.mf looks like following:
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: fsm.design
> Bundle-SymbolicName: fsm.design;singleton:=true
> Bundle-Version: 1.0.0
> Bundle-Activator: fsm.design.Activator
> Require-Bundle: org.eclipse.ui,
> org.eclipse.core.runtime,
> org.eclipse.core.resources,
> org.eclipse.sirius,
> org.eclipse.sirius.common.acceleo.aql
> Bundle-ActivationPolicy: lazy
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>
> What should I add to it ?
You have two solutions:
. In textual mode, you can add a comma
org.eclipse.sirius.common.acceleo.aql and your the id of the plugin
containing your ecore model in a new line.
. You can also open the MANIFEST.MF with the Plug-in Manifest Editor,
open the Dependencies tab and add your plug-in using the add button.
Regards,
>
> Thanks a lot
> Bests,
> Parsa
>
>
>
>
> Maxime Porhel wrote on Wed, 28 October 2015 11:20
>> Hi Parsa and Axel,
>>
>>
>> I am currently working on Bug 479726 [1] which seems to correspond to
>> your situation.
>>
>>
>> The simplest solution to your issue is to add a dependency to your
>> metamodel plugin(s) in the MANIFEST.MF of your Viewpoint Specification
>> Project. This will allow the AQL interpreter to retrieve your
>> metamodels during the evaluation of the type literals (like
>> fsm::NormalState). Furthermore, this will make your modeler plugin non
>> installable if your domain plugins are not present.
>>
>> The second idea I proposed this morning also works but only if you use
>> the "Add from registry" button to reference your metamodel for each
>> representation description (implies to develop the VSM with the
>> metamodel deployed). This make the dependency to the metamodel
>> plugin(s) optional (until you write Java services without importing
>> required packages in the MANIFEST.MF).
>>
>> Sirius 3.1.1 is expected to be released soon, Bug 479726 will be
>> resolved for this version but the correction will only consist in
>> Documentation, Tutorial and Release Notes updates and a new bugzilla
>> will be created to think about a proper enhancement of the situation.
>>
>>
>> Regards
>>
>>
>> Le 28/10/2015 09:49, Maxime Porhel a écrit :
>> > Le 27/10/2015 19:13, Parsa Pourali a écrit :
>> >> From what I can see here,
>> >> the version of Sirius is 3.1.0.201510150803
>> >> Acceleo 3.6.2.201510121214
>> >> Acceleo Query SDK 4.0.0.201510121214
>> >> Also my Eclipse is Mars.
>> >>
>> >
>> > Could you try/check the following configurations:
>> > . Make your VSM plugin depends on your metamodel plugins
>> > . In your the Viewpoint Specification Editor, on your
>> > Diagram/Tree/Table description, select the Metamodels tab in the
>> > properties view and add your metamodel. This should help aql for the
>> > completion and validation.
>> >
>> >
>>
>>
>> --
>> Maxime - Obeo
>>
>> Need training or professional services for Sirius?
>> http://www.obeodesigner.com/sirius
>> --
>> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=479726
>
>
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: AQL expression for setname() in Sirius [message #1713027 is a reply to message #1712914] |
Thu, 29 October 2015 22:47 |
Parsa Pourali Messages: 210 Registered: February 2014 |
Senior Member |
|
|
Hi Maxime,
Thanks, I have added the dependency, still didn't work. but that's ok, I will drop it for now and will wait for new release.
However, I have another query. I want to auto number the transition labels such as t1, t2 , t3 ...
I used the following query:
aql:'t'+(source.eContainer().transitions->size()+1).toString()+': '
the funny part is that it actually works , but when I validate my VSM it throw an error: "Feature transitions not found in EClass NormalState".
Why is it looking for transition in Normal state. I used source.eContainer(), where source is the normal state the transition connects to. And I suppose source.eContainer will be StateMachine ... Just confused, if it is an error then why it works ?
Thanks,
Parsa
-
Attachment: metamodel.png
(Size: 12.80KB, Downloaded 1747 times) -
Attachment: VSM.png
(Size: 76.42KB, Downloaded 1929 times)
[Updated on: Thu, 29 October 2015 22:48] Report message to a moderator
|
|
|
Re: AQL expression for setname() in Sirius [message #1713048 is a reply to message #1713027] |
Fri, 30 October 2015 09:53 |
|
Le 29/10/2015 23:47, Parsa Pourali a écrit :
> Hi Maxime,
>
> Thanks, I have added the dependency, still didn't work. but that's ok, I will drop it for now and will wait for new release.
>
> However, I have another query. I want to auto number the transition labels such as t1, t2 , t3 ...
>
> I used the following query:
> aql:'t'+(source.eContainer().transitions->size()+1).toString()+': '
>
> the funny part is that it actually works , but when I validate my VSM it throw an error:
> Compilation error for expression [eContainer().eGet(transitions)->size()/] : Unrecognized variable: (transitions)
It is "simple" : eContainer() returns an EObject and "transitions" is
not defined for EObject. You must "cast" the result of eContainer() if
you want that the validation is OK.
>
> It says that "Feature transitions not found in EClass NormalState".
>
> Why is it looking for transition in Normal state. I used source.eContainer(), where source is the normal state the transition connects to. And I suppose source.eContainer will be StateMachine ... Just confused, if it is an error then why it works ? :d
At runtime the real object returned by eContainer() is a StateMachine,
so at runtime the "eContainer().eGet(transitions)" works.
>
>
>
>
> Thanks,
> Parsa
>
Regards,
--
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 02:14:02 GMT 2024
Powered by FUDForum. Page generated in 0.04525 seconds
|