AQL query works on Sirius interpreter, returns error on M2DOC

The query below:
returns the following items on Sirius interpreter:
When I use a similar construction on M2Doc the generated doc returns the following error:
{m:for ce | mySystemEngineering.containedPhysicalArchitectures.eAllContents(fa::ComponentExchange)}
Invalid for statement: Expression “mySystemEngineering.containedPhysicalArchitectures.eAllContents(fa::ComponentExchange)” is invalid: invalid type literal fa::ComponentExchange
How is that possible?
(thanks in advance for any light on this)

2020-03-04 17_05_47-workspace - platform__resource_Aircraft_Aircraft.aird_[PAB] Structure - Capella.png
2020-03-04 17_05_47-workspace - platform__resource_Aircraft_Aircraft.aird_[PAB] Structure - Capella.png

You need to add the needed metamodels to your template (see the
documentation and the nsURI tab). Use the add button and select capella.
If you are using the last version of M2Doc extensions for Capella 1.4.0. You can simply select the Capella token on the first tab.

Thanks Yvan! That solved the issue!

I had another example that wasn’t fixed by adding the Capella component on the template editor. What could be the problem?
Sirius interpreter:
List of Orientations of all ports in the ComponentExchanges (IN, OUT and INOUT)
My Template file:
{ m:for ce | self.eAllContents(fa::ComponentExchange) }
Component Exchange: { }
Source: { m:ce.source.eContainer().name }
Target: { }
Orientation: { m:ce.source.orientation }
{ m:endfor }
Generated docx file:
Orientation: { m:ce.source.orientation } Invalid query statement: Feature orientation not found in EClass InformationsExchanger
When I use the Sirius interpreter in Capella I am able to access the ComponentExchange port and its orientation. In M2DOC it says the ‘feature orientation not found in EClass InformationExchanger’. I thought the ce.source (or self.eAllContents(fa::ComponentExchange).source) was of the type ComponentPort (so I could access the ‘orientation’ feature in it) but M2Doc says it is an EClass InformationExchanger…
What am I missing here?

1 Like

I found the solution by myself. I’ll share here for future reference:
It seems the problem was the type returned by “ce.source” was something more generic than the ComponentPort (which has the orientation feature).
I just added a cast (or typed it) as fa::ComponentPort using “oclAsType()” and then I was able to call the “orientation” feature.
ce is a variable containing a component exchange: for ce | self.eAllContens(fa::ComponentExchange)
Not sure if that is the real reason but that was how I reasoned about it.