AQL query works on Sirius interpreter, returns error on M2DOC 3.2.1 (resolved)

Hello,

It seems, i have the same problem as the one identified in this topic ( AQL query works on Sirius interpreter, returns error on M2DOC)

My error message is:
{m:self.eAllContents(pa:PhysicalComponent)->at(3).description} Invalid query statement: Expression “self.eAllContents(pa:PhysicalComponent)->at(3).description” is invalid: invalid type literal pa: `

Yet this AQL query worked with the Sirium interpreter (in Capella).

I read the aswers of the other topic but:

  • It seems that the M2DOC documentation is not up 2 date, as a matter of fact, the “template Editor” show in the documentation is not the same in M2DOC 3.2.1. (The 3 options : Packages, nsURI(expert), Services(expert), are available on a pop up window contrary to what is shown in the docu).
  • Upon opening the nsURI(expert) or Services(expert) tabs, it seems that all availables metamodels/ services have been already added, am I wrong?
  • If not, then whenever i select one of the available options and click on “Add”, the button “Finish” keep being hidden (unclickable), it seems there is no way to add these options.

How is it possible to get rid of this message error?
Thanks

Make sure you have the nsURI of the pa pckage imported in your template using the template properties wizard:

http://www.polarsys.org/capella/core/pa/5.0.0

The version might change depending of which Capella version you are using.

You also have a missing semicolon in the type reference:

pa::PhysicalComponent

The same AQL interpreter is used in both the Sirius interpreter and M2Doc, only the configuration can be different depending on which nsURIs and services you import. You can also use the M2Doc interpreter. It will be configured in the context of a generation configuration (.genconf file). This way you will have the exact same context, also the interpreter tries to have a rendering similar to what will be inserted in the generated document.

I was not aware there was 2 interpreters, thanks.
image
How to select the genconf model though? Sorry for what seems to be a question with a very simple answer but i don’t see it.

There was another error:
The variable i was using was “self” which is not the one i had configured. This could helps anyone reading this in the future.

In the M2Doc interpreter, you don’t need the aq: prefix. You can access all variables from your template plus a variable named selection. The selection variable value will change depending on what you select in Capella. It can be useful to prototype and test AQL expressions.

To select a .genconf file you can use the button on the top right corner of the interpreter view. If you change the configuration of your template you will need to reload the .genconf file using the refresh button also on the top right corner of the view.

1 Like

Pretty interesting. Thank you. Sorry my screen was zoomed in i had not seen the generation button in the tutorial otherwise i would not have asked.

I will have to write probably one last important topic at end of the day (or tomorrow morning). I have to get the maximum of information and do intensive testing beforewise.

Don’t worry and ask your questions, it can also be useful for other readers.

1 Like