How to include pre/postconditions in generated document


Is there a way of including the pre- and postconditions of system capabilities into the generated word document? I didn’t found an example and I’ve tried myself to enhance the template, but without any success.

I’m using Capella4Teams 1.3.1 with M2doc

Kind regards, Peter


If you already have the Capability object you can use something like:

To get the capability in the first place if you are on a System object and want capabilitys from the SystemAnalysis you can use:

Note there are other places where you can find Capabilities:




Hi Yvan, thanks for your help. Unfortunately it doesn’t seem to work as aql query and in the m2doc template. Despite there are pre- and postconditions defined on a system capability the string generated is empty. See my screenshots below:

I’m able to access the pre- and postconditions with this aql query:

But in m2doc it is not possible to access bodies:

Any ideas, how to solve this problem?


After looking at The Capella metamodels I found that the object referenced by a Capability.preCondition or .postCondition is a Constraint and it can be of different natures, so I looked in the definition of the odesign and found a service that can represent those objects in a human readable way. But the service seems to reference an editor and I’m not sure if it will work with M2Doc, anyway you can try by importing the service class in your template (using the template properties wizard):


Then you can call:


The returned text will be the same as in the property view so you might need to change it a bit to fit your needs.

For the second point, the error happens because the Constraint.ownedSpecification can be diffent kinds of objects for instance an OpaqueExpression with a feature body or a ValueSpecification that don’t have a feaure body.

Hope it help,


I’m still struggling to import the service class. The template properties wizard, doesn’t offer any service to choose. I’ve tried to follow the instructions on the refered reference documentation. However I hadn’t any success. Are there any prerequisites for using the CapellaServices?

Kind regards, Peter

This dialog is using the JDT and is only populated if a plugin project is opened in the workspace. This project should have dependencies to Capella plugins. To make things easier in the future, I’ll add those classes to the Capella token accessible in the template properties wizard:

That was the missing piece! Thank you for your help.

Short recap about the steps that I needed to do:

1.) Installing m2doc plugin (

2.) Create a plugin project in capella. Added org.polarsys.capella.core.sirius.analysis to the depencies

3.) Add the CapellaServices to the Capella project

4.) Enhance the m2doc template

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