Any hints on how I could retrieve the list of referencing elements for an element of the model ?
More specifically, I want to get the list of the scenarios referencing a specific component.
If the scenario directly reference the Component you can use:
you can also filter with the type of scenario or use the name of the reference between scenario and component as parameter.
But it doesn’t seems like a direct relation. Maybe someone having a deeper understanding of the Capella metamodel can help you.
Yes, it is not a direct relation.
The component does not appear in the “Referenced Elements” list of the scenarios. Somehow the Semantic Browser is able to do that so the relation exists, but not sure that there is an aql attribute or method to get those.
Here is a query that may help (I am not saying that this is the most efficient one), it is finding all the OA Scenarios that are containing an “Aircraft” entity…
eAllContents()->filter(interaction::Scenario)->select(s | s.ownedInstanceRoles->one(i | i.representedInstance.name = ‘Aircraft’))
I hope this helps
It is working as expected ! Thanks !
My 2 cents:
Sadly, the learning curve with M2Doc is really slow and one have to constently invent new ways to extract the information from the model.
I think that it could be easier if the possibiity of M2Doc was at least aligned with what the Semantic Browser displays.
Example:The Semantic Browser displays a relation between 2 elements -> Just use self.nameOfTheRelation or something similar but with always the same syntax.
While being true for some of them, it is not always the case (and sometimes it is only because the name is slightly different).
This could be a service for instance semanticRelation(‘relation name’). You can open a bug
here this way it might be implemented.
The main problem with M2Doc is the lack of completion. I’m working on this.