Requirement allocation

Hello guys. How to get the source elements/target elements of a requirement’s incoming links/outcoming links with m2doc?

If you start from the Requirement itself, you will need to add needed nsURIs to your template using the template properties wizard:

The last one might change depending on the version of ReqIf you are using. But you should see something similar in the list.

Then you can use the following for incoming links:

requirement.eInverse('target')->filter(CapellaRequirements::CapellaOutgoingRelation).source

and for outgoing links:

requirement.ownedRelations->filter(CapellaRequirements::CapellaIncomingRelation).target

You can also use the following for incoming requirements from a CapellaElement:

capellaElement.eInverse('target')->filter(CapellaRequirements::CapellaIncomingRelation).source

and for outgoing requirements:

capellaElement.ownedExtensions->filter(CapellaRequirements::CapellaOutgoingRelation).target
2 Likes


Hi! There’s error in my genereated file. How to avoid it?

There is no cross referencer installed, the cross referencer is used by the eInverse() services and is used has a cache. It should be installed by Sirius (the technology providing graphical representation to Capella). You can ask M2Doc to install its own by adding the following option to your generation conficuration (.genconf file):

  • InstallCrossReferenceAdapter true

You should not have to do this in the context of Capella… Maybe if your requirement is not attached to the Capella model or its resource is not a semantic resource form Sirius it can happen.
Activating this option can have an impact on the performance depending on the size of your Capella model.

1 Like