How to query Logical Functions and (other types) with aql

Hi all, I just wanted to post this brief ‘how-to’ here since I just did it for a colleague which wanted to export many logical functions as a csv (using mass visualization view) which were all organized in packages. Her problem was: “how to easily list all logical functions in my project so I can select them and send to mass visualization view?”.

The procedure below uses the Sirius interpreter in Capella and the aql query language to accomplish that.
The query used was: “aql:self.eAllContents(la::LogicalFunction)” and the ‘queried’ element was “Logical Architecture” hence selecting all logical functions within the “Logical Architecture” element (yes, it would also work if I selected any other model element that contains Logical Architecture).

1.Open Sirius Interpreter:
Window > Show View > Other…
image

Select: Other > Interpreter

2.Insert the query: “aql:self.eAllContents(la::LogicalFunction)”
image

3.Select the “Logical Architecture” element (or any element that contains it, e.g. project folder)
image

4.Select the functions in the list and use as needed:
image

About the query:

aql:self.eAllContents(la::LogicalFunction)

aql: → just a prefix meaning you are using the aql query language.(don’t konw of any others used)
self → is the element you select (either on project explorer or in a diagram)
eAllContents() → function that gets all contents from a model element (every element contained directly or indirectly in that element) - apparently works with any model element in Capella…
la::LogicalFunction → A definition of model element type, you could use others to make a similar selection for example of logical components (using la::LogicalComponent). There are more general element types such as “abstract functions” which could be used to query all functions at once or all component types, but you’d have to look for them (see below).

A complete reference of the model elements that can be used and the namespaces (the names before the ‘::’) must be consulted in the Capella metamodel which I’m really lazy to go, download and read… I have found that the queries in the sample M2Doc templates will cover most of my needs…

Download m2doc templates and display the field codes so you can view the queries there…
m2Doc templates available at bottom of this page: Capella M2Doc tutorial - M2Doc
How to show field codes in word: How to turn on field codes in Microsoft Word - so you can view the queries there)

Thank you very much Fabio for this contribution.

For queries/outputs that may be a little bit more complicated, one may consider using Python4Capella as well (but it requires a little bit more technical knowledge as well)

Stephane