Unable to find source name

Hi everyone,

I’m working on a M2Doc template that will be used to generate automatically a requirement traceability file.

At a certain point in the document, I would like to have a requirement traceability table that links the requirements with the Capella elements that are allocated to them. Here is what I tried to do to achieve this:

But then something weird happens. Everything works great except for the “Name” section where I got an error in the generated file, which says : “Feature name not found in EClass CapellaElement”:

However, when I use the Sirius interpreter in Capella, it seems that it should normally work:

Does any of you have an explanation about this behaviour ?

On top of that, if someone has an idea about how to retrieve the type of element (e.g. “functional exchange” or “logical function”), I would also be glad to hear it.

Thanks !

Pierre

interpreter_query.PNG
result.PNG

The EClass CapellaElementdoesn’t has a feature name. You will need to cast the source element to capellacore::NamedElement:

relation.source.oclAsType(capellacore::NamedElement).name

Of course this will only works if the source is a NamedElement.

To retrieve the type of an element you can use element.eClass().

Thank you very much Yvan, it works just as expected.

I first thought that I could get the name by using relation.source.name because relation.source alone returned a long message containing an “id” field but also a “name” field. I’m kind of new to those advanced features of Capella so I’m not yet so familiar with its data structure and metamodel.