AQL expression in Sirius interpreter

I am using AQL for one of my usecase:

Looking at the documentation in AQL in the Help section, I am not able to use filter functionality and conditions functionality in the Sirius interpreter. Example of them follows:

  1. filter:
    I am trying to filter Constraint object from the below query:


    Hence, I tried filter Constraint using filter() but didn’t work:

  2. Conditions: Not able to use if else in sirius interpreter

Please correct me if I am doing something wrong.

Thank you in advance :wink:

Hi Dev,

  1. I think You need to filter on capellacore::Constaint. You can direclty include the filter in the eContents() or eAllContents(). This way AQL will try to prune branches of the model:
self.target.eContents(capellacore::Constaint)

If you want to keep more than one type of element you can also use this kind of filter.

self.target.eContents({capellacore::Constaint | fa::FunctionalChainInvolvementFunction})
  1. The if statement looks correct depending on what element you call it on. But you forgot the aql: prefix so Sirius can delegate the evaluation of the expression to AQL.

You should probably use the M2Doc Interpreter view initialized with your .genconf file. It will evaluate AQL expressions in the context of your template. You still have access to the current selection with the selection variable.

1 Like

Hey Good Morning,

Explanation: I am trying to show the literal value in the title block, but I am able to get the id as the context is stored in the form of Constraint.

AQL query: (Applied on the Functional Chain Descriptor Diagram(FCD) diagram)
aql:self.target.eContents()->select(ele|ele.summary='FCI').exchangeContext.ownedSpecification.bodies.substring(10,45)

Here: select(ele|ele.summary='FCI') is filtering the Functional Chain Involvement Links in the diagram as those elements are having the value to be populated in the Title block.

Result:
image

Following are my queries:

Q1: I want to access the String Literal Value referenced in the Exchange Context, is there any other way to achieve that?

Q2: Are nested AQL query possible. e.g. If can use this sequence of IDs obtained by the above query to filter those element who have any of the id present in it?

Q3: I could have used the ->filter(fa::FunctionalChainInvolvementLink) to filter them, but I observed that while it worked in Sirius interpreter, it didn’t work when place in the title block. Why so?


Using the same query inside the title block:
image

Thank you in advance :wink:

Hi Dev,

  1.  myFunctionalChainInvolvementLink.exchangeContext.ownedSpecification...
    

From here the remaining of the expression depend on what type of ValueSpecification is used. You can open the .capella file to find your FunctionalChainInvolvementLink by its ID for instance and have a look at the structure of its exchangeContext. The XML structure should give you the EReferences to navigate. I think you should have an implementation of AbstractEnumerationValue but I’m no sure which one.

  1. Yes, you can use the let expression.

  2. It depend how the AQL interpreter has been initialized in the title block. Maybe some EPackages (metamodels) are not registered… But it looks like it’s using the Sirius interpreter. You can ask in the main forum how the title block interpreter is initialized.

Thank you for your reply, it really helped: Created a query using variables and filtered the required literal values

1 Like