-
Key: UMLR-275
-
Legacy Issue Number: 17564
-
Status: open
-
Source: NASA ( Dr. Nicolas F. Rouquette)
-
Summary:
UML needs to explain in terms of UML what applying and associating
stereotypes means and additionally needs to explain all aspects of their
serialization. The UML specification has yet to explain what it means what "applying a stereotype" and what "stereotypes can participate in associations" mean in terms of UML.Since the UML profile mechanism is definitely not a metamodeling extension facility, these explanations must be made in terms of UML directly rather than indirectly via the "MOF2-equivalent semantics".
Below is a 3-step proposal to explain what "applying a stereotype" and "stereotypes can participate in associations" mean in terms of UML.
This proposal is illustrated using the SysML profile definition of the ValueType, Unit and QuantityKind stereotypes shown below:Point #1) The UML specification only shows how an instance of a stereotype is serialized but it does not say what that serialization is in terms of the UML metamodel.
For example, we have:
- 2 serializations of UML::InstanceSpecification
<packagedElement xmi:type="uml:InstanceSpecification"
xmi:id="_ISO-80000-1-SysML_mass_PackageableElement"
name="mass">
<packagedElement xmi:type="uml:InstanceSpecification"
xmi:id="_ISO-80000-1-SysML_kilogram_PackageableElement"
name="kilogram">
- 2 serializations of instances of stereotypes, QuantityKind and Unit.
<sysml:QuantityKind xmi:id="ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
base_InstanceSpecification="_ISO-80000-1-SysML_mass_PackageableElement"/>
<sysml:Unit xmi:id="ISO-80000-1-SysML_kilogram_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
base_InstanceSpecification="_ISO-80000-1-SysML_kilogram_PackageableElement"
quantityKind="_ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance"
symbol="kg"/>
I claim that serializations of instances of stereotypes are in fact just serializations of UML::InstanceSpecifications whose classifiers are stereotypes.
That is, the above two elements are really a different serialization of the following:
<packagedElement xmi:id="ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
xmi:type="uml:InstanceSpecification"
classifier="_SysML_Blocks_PackageableElement-QuantityKind_PackageableElement"
base_InstanceSpecification="_ISO-80000-1-SysML_mass_PackageableElement"/><packagedElement xmi:id="ISO-80000-1-SysML_kilogram_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
xmi:type="uml:InstanceSpecification"
classifier="_SysML_Blocks_PackageableElement-Unit_PackageableElement"
base_InstanceSpecification="_ISO-80000-1-SysML_kilogram_PackageableElement"
quantityKind="_ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance"
symbol="kg"/>
The rationale for this is simply that we must be able to specify constraints in OCL as well as queries/transformations in QVT and actions in any action language (e.g., ALF) where we can operate on instances of stereotypes without having to implement profile-specific tooling.
Point #2) The UML specification should explicitly say that:
2.1) an instance of a stereotype is a distinguished instance of UML::InstanceSpecification whose classifier is the stereotype definition
2.2) what distinguishes an UML::InstanceSpecification whose classifier is a UML::Stereotype is that it is serialized differently than any other UML::InstanceSpecification (whose classifier is not a UML::Stereotype)
The rationale for (2.1) is that this is the simplest way to address this point without introducing a new metaclass in the UML metamodel.
The rationale for (2.2) is that we need a way to tell how to serialize any UML::InstanceSpecification, whether it is an instance of a stereotype or something else.Point #3) The meaning of "stereotypes can participate in associations" is that it is possible to create link instance of such an association (i.e., a UML::InstanceSpecifications) and that the slots of this link instance refer to the distinguished UML::InstanceSpecifications corresponding to the instances of the stereotypes related via such a link.
The problem is that the UML specification (2.4 and 2.5) does not say how to serialize such links.
This is something that caused me a lot of headaches when producing the XMI for SysML 1.3.
Because the ISO-80000-1-SysML.xmi and ISO-80000-1-QUDV.xmi are libraries, there will be references to elements defined in them.
Since the SysML profile has associations between Unit & QuantityKind, it means that we should be able to externally refer to particular links between particular instances of Unit & QuantityKind.I tried to do this in 1.3 but I realize that I got it wrong, specifically, the slot values refer to the UML elements representing Unit and QuantityKind when in fact they should be referring to the distinguished UML::InstanceSpecifications representing the instances of Unit & QuantityKind (see in bold below):
<packagedElement xmi:type="uml:InstanceSpecification"
xmi:id="_ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement"
name="a_kilogram[unit]_mass[quantityKind]">
<classifier href="http://www.omg.org/spec/SysML/20120322/SysML.xmi#_SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement"/>
<slot xmi:type="uml:Slot"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slot_Slot._SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement-unit_Property">
<definingFeature href="http://www.omg.org/spec/SysML/20120322/SysML.xmi#_SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement-unit_Property"/>
<value xmi:type="uml:InstanceValue"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slotSlot._SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement-unit_Property-value_ValueSpecification.0"
instance="_ISO-80000-1-SysML_kilogram_PackageableElement"/>
</slot>
<slot xmi:type="uml:Slot"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slot_Slot._SysML_Blocks_PackageableElement-Unit_PackageableElement-quantityKind_Property">
<definingFeature href="http://www.omg.org/spec/SysML/20120322/SysML.xmi#_SysML_Blocks_PackageableElement-Unit_PackageableElement-quantityKind_Property"/>
<value xmi:type="uml:InstanceValue"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slotSlot._SysML_Blocks_PackageableElement-Unit_PackageableElement-quantityKind_Property-value_ValueSpecification.0"
instance="_ISO-80000-1-SysML_mass_PackageableElement"/>
</slot>
</packagedElement>
These should have been:
<packagedElement xmi:type="uml:InstanceSpecification"
xmi:id="_ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement"
name="a_kilogram[unit]_mass[quantityKind]">
<classifier href="http://www.omg.org/spec/SysML/20120322/SysML.xmi#_SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement"/>
<slot xmi:type="uml:Slot"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slot_Slot._SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement-unit_Property">
<definingFeature href="http://www.omg.org/spec/SysML/20120322/SysML.xmi#_SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement-unit_Property"/>
<value xmi:type="uml:InstanceValue"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slotSlot._SysML_Blocks_PackageableElement-A_unit_quantityKind_PackageableElement-unit_Property-value_ValueSpecification.0"
instance="ISO-80000-1-SysML_kilogram_PackageableElement-appliedStereotypeInstance_InstanceSpecification"/>
</slot>
<slot xmi:type="uml:Slot"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slot_Slot._SysML_Blocks_PackageableElement-Unit_PackageableElement-quantityKind_Property">
<definingFeature href="http://www.omg.org/spec/SysML/20120322/SysML.xmi#_SysML_Blocks_PackageableElement-Unit_PackageableElement-quantityKind_Property"/>
<value xmi:type="uml:InstanceValue"
xmi:id="ISO-80000-1-SysML_a_kilogram_u00255Bunit_u00255D_mass_u00255BquantityKind_u00255D_PackageableElement-slotSlot._SysML_Blocks_PackageableElement-Unit_PackageableElement-quantityKind_Property-value_ValueSpecification.0"
instance="ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance_InstanceSpecification"/>
</slot>
</packagedElement>
Point #3) There is no crossing of metalevels in SysML's ValueType (extension of UML::DataType) associated to stereotypes extending UML::InstanceSpecification (Unit, QuantityKind)
In practice, it means that if we defined, say, "MassInKilograms", a UML::DataType and applied SysML::ValueType to it, we would have something like this:
<packagedElement xmi:type="uml:DataType"
xmi:id="123"
name="MassInKilograms"/>
<sysml:ValueType xmi:id="456" base_DataType="123"
unit="ISO-80000-1-SysML_kilogram_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
quantityKind="ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance_InstanceSpecification"/>
And we should be able to explicitly create a link instance for the association between ValueType & Unit and its slots would refer to the distinguished UML::InstanceSpecifications corresponding to the stereotype instances thus related, I.e.:
"456" and "ISO-80000-1-SysML_kilogram_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
Similarly, the link instance for the association between ValueType & QuantityKind would have as its slots the following:
"456" and "ISO-80000-1-SysML_mass_PackageableElement-appliedStereotypeInstance_InstanceSpecification"
The rationale for this point is that since stereotypes can participate in associations, it follows that instances of stereotypes can be linked via instances of such associations.
-
Reported: UML 2.5 — Mon, 27 Aug 2012 04:00 GMT
-
Updated: Fri, 6 Mar 2015 20:57 GMT
UMLR — applying and associating stereotypes and explanation of all aspects of their serialization
- Key: UMLR-275
- OMG Task Force: UML 2.6 RTF