[M2Doc]: How to get BehaviorComponent of a Diagram

I have the following diagram with 2 NodeComponents and 2 BehaviorComponents.

But when I try to list all PhysicalComponents with the following query, only the 2 NodeCompenents are retrieved, the BehavaviorComponents not.

Here is the result :


Why are BehaviorComponents not retrieved?


In some cases the PhysicalComponent is not referenced directly by the DDiagramElement. Instead an element of type Part is referenced. You can check this by selecting element of your diagram and using the following expression in the M2Doc interpreter:


In this case, you will need to retrieve the Part type. To do so, you can add the following select() call:

semanticElements->select(se | if se.oclIsKindOf(cs::Part) then se.type else se endif)->filter(pa::PhysicalComponent)

Let me know if it solve your issue.

1 Like

Hi Yvan,

Thanks for your explanation that gave me the right way to follow.
Finally and used the query :


and its works.


Both node components and behavior components (and other kind of elements) can be represented using Part. You should probably stick with the select() call I provided to avoid missing an element.

I had a problem very close to this one in Logical Architecture with logical components, and this tread has helped me a lot ! Thank you Yvan.

Thank you, that the aim of this forum.

Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.