Accessing Libraries from M2Doc

Hello everyone. I have a project where the main model references in read-only mode two libraries. The libraries contain quantities and units, which are used in the data model of the main model (e.g. for typing the class properties).
I’d like to access the libraries within my generated document (e.g. in an appendix) in order to document their content, and, which is most important, to resolve the links from the class properties.

As usual, in my template the ‘self’ variable points to the main model.
Replicating the same situation in the interpreter, all I’ve found is that using self.siblings() I’m able to display, under “Library Dependencies”, my two libraries.
I may do more or less the same in the template but I’m stuck here as I don’t know how to manipulate the references I get. Moreover, I get a lot of other stuff together with the two references, and I’m not even able to filter only the two references, as I’ve found nothing similar to a LibraryReference to put in a filter…

Any hint?

Thanks in advance,

I’m not sure how the libraries are referenced, but you can have a look at the ownedExtensions feature on the main SystemEngineering. You can also filter siblings() by the type of the library object. You can get the type of the library with .eClass().

Hi everybody,
I wanted to share a solution to my last question, i.e. how to dereference a LibraryReference.

The following snippet lists the names of the libraries included by the main System Architecture, pointed by the “self” variable

{m:if not self.siblings().eContents(libraries::LibraryReference)->isEmpty()}
{m:for lib | self.siblings().eContents(libraries::LibraryReference).library.eInverse(capellamodeller::Library)}

Library: {}


Maybe it’s not the most elegant, but it seems to work both on the interpreter and in the template.
Of course, starting from the current variable “lib” it is now possible to browse and document the library contents.
I hope this may be useful,


Thank you for sharing your solution.