IBM Support

Retrieving attributes inherited from the base class using a IBM Rhapsody project and IBM Publishing Document Studio

Question & Answer


Question

How to retrieve attributes inherited from the base class using a IBM Rhapsody project and IBM Publishing Document Studio
Author: Chris Sutton

Cause

The model used in this example consists of two classes. The parent class has an attribute. The child class is inheriting the attribute from the parent class.
image 8156

Answer

You can access the generalizations for each class inheritance and traverse the metamodel to the attributes of the base class.
However, the Rhapsody metamodel provides a Base node that can be used as a shortcut to access the base class directly from the child class.
The metaclass of the node under Base is of type Classifier. This is too generic and does not allow access to the typical data contained under a class. Therefore, you must cast the Classifier node to a Class node. This is highlighted in the screenshot below.
image 8155
More information on using casting in IBM Publishing Document Studio can be found here:
Now that the Classifier node is recast to the correct type it can be used in query $25 and the attribute node can be used in query $27.
The output shows all classes, all nested base classes and all nested attributes within those base classes:
image 8157

Example Project Files
These project files were created with:
- IBM Engineering Lifecycle Optimization - Publishing Document Studio v7.0.2
- IBM Engineering Systems Design Rhapsody® 9.0.1 (Build No. 9.0.1.R00_202006101734 64bit)

[{"Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"ARM Category":[{"code":"a8m50000000CjSOAA0","label":"Rhapsody->Collaborations->Rational Publishing Engine"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
27 May 2022

UID

ibm16411225