Viewpoint DSL - One example

I am trying to understand the Capella Viewpoint DSL usage.

I have tried to follow the tutorials but I can’t do something as simple as adding a new attribute to an existing class in Capella such as Physical Nodes. How should I configure the desc, data and ui files so that I am able to:

1.Set an additional string attribute to Physical Nodes named “Custom string”
2.Make it editable in a section named “Custom section” within the property pages of Physical Nodes

I guess this should be really simple using the VPDSL but I couldn’t figure out how to do it…

Hi,

Indeed you cannot directly modify a Capella Element to add a new attribute/relation. This would mean modify the definition of the Capella Element class and this may seem trivial but it is not.

In the Viewpoint DSL data aspect, when you create a new class “A” that “extends” a class “C” from Capella, it means that you will be able to create “A” instances stored inside “C” instances. (They will be stored in the “ownedExtensions” reference of the “C” instance). See https://wiki.eclipse.org/Capella/Viewpoints/Practice#Data for an example on the BasicMass viewpoint.

As there is also a superclass relation in the Viewpoint DSL, a solution to your problem could be to create a new class “A” with superclass “C” but extending the parent of “C”. This way you will create a sibling of “C” with its attributes and relations. But be careful, the class hierarchy of Capella is not simple and you may have multiple possible parent for “C”.

Regards
Arnaud

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