|
Re: AQL query problems [message #1719338 is a reply to message #1719321] |
Thu, 07 January 2016 10:41 |
|
Le 07/01/2016 09:31, Christian Pontesegger a écrit :
> Hi,
Hello
>
> I would like to start using AQL queries but am a total novice, so I soon
> ran into some problems:
>
> my edge creation tool needs to query for a Precondition:
> aql:preSource.successors->size() < aql.preSource->getMaxSuccessorCount()
> where successors keeps references to other EObjects. size() works
> correctly, the query works if I replace the righthand side by an int
> constant.
> getMaxSuccessorCount() is an EOperation defined in the model. However
> this query does not work, how do I call getMaxSuccessorCount() correctly?
First, you wrote "aql.preSource->getMaxSuccessorCount()". Simply write
preSource->getMaxSuccessorCount()
Second, check that presource is the good type on which you have
getMaxSuccessorCount() method
>
> how do I debug such queries correctly?
> The model requests interpreter simply shows no results, but also no
> error messages
> (of course I replaced the preSource reference by self.target and
> selected the correct node)
>
yes Interpreter view is a good way to test your expression. Choose
Sirius interpreter in the drop down list
> thanks
> Christian
>
Regards
Laurent
Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
Re: AQL query problems [message #1719401 is a reply to message #1719344] |
Thu, 07 January 2016 16:23 |
Cedric Brun Messages: 431 Registered: July 2009 |
Senior Member |
|
|
> still aql:self.target.getMaxSuccessorCount() does not work, neither in the Interpreter view, nor for the precondition. When used in the precondition it always returns false and edge creation is disabled.
This definitely looks like a bug then. Isn't the implementation called at all ? did you try setting a breakpoint ? Can you confirm your ecore model is deployed as a plugin and is not in the runtime workspace ?
Furthermore, errors should have been reported in the interpreter view, isn't there anything in the error log neither ?
These areas have been improved quite a bit in the last few months, could you please give us the exact versions of AQL (org.eclipse.acceleo.query) and Sirius (org.eclipse.sirius) involved please ?
A query like :
aql:preSource.getSuccessors().size() < 2
would mean "call the method size() on every element which is in the collection returned by getSuccessors() whereas ->size() means "call the method size() on the collection.
In this case I guess there is no such method (could be an EOperation or a method contributed through an external Java class with the signature :
public int size(Successor s)
Let's say you start from an EPackage :
aql:self.eAllContents(ecore::EAttribute).name
will return a list containing all the names, a list of String then.
aql:self.eAllContents(ecore::EAttribute).someCall()
will apply the call on every EAttribute and return a list containing the results of these calls.
http://cedric.brun.io news and articles on eclipse and eclipse modeling.
|
|
|
Powered by
FUDForum. Page generated in 0.03632 seconds