Skip to main content

Generalization

ElementClasses can define a superclass. Instances of one of these ElementClasses can then also be used as an instance of the SuperClass.

This feature is designed to support polymorphism in the models.

  • References can target an abstract ElementClass. Subclasses can then provide a variety of implementations for the superclass.

  • Expanders can also target the superclass to expand artifacts that are common for the subclasses.

  • The ElementClass will inherit all Attributes and References of its superclass.

  • The superclass itself needs to be abstract. Abstract ElementClassed cannot be instantiated. Instead, they can only be represented by subclasses.

  • Optionally, the superclass can be sealed. In this case, it cannot be extended by ElementClasses from other ontologies. This means all subclasses are known and can be enumerated.

<elementClass name="EnumType">
<group name="root" ontology="enumTypeElements"/>
<role name="element"/>
<superClass name="ValueType" ontology="elements"/>
<attributes>
<attribute name="packageName">
<isIdentifier>false</isIdentifier>
<dataType name="PackageName" ontology="enumTypeElements"/>
</attribute>
</attributes>
</elementClass>
<elementClass name="ValueType">
<isAbstract>true</isAbstract>
<isSealed>false</isSealed>
<group name="valueTypes" ontology="elements"/>
<role name="data"/>
<attributes>
<attribute name="name">
<isIdentifier>true</isIdentifier>
<dataType name="Name" ontology="elements"/>
</attribute>
<attribute name="description">
<isIdentifier>false</isIdentifier>
<dataType name="Description" ontology="elements"/>
</attribute>
</attributes>
</elementClass>