There is a need in the new Exchange to use untyped References and VersionedReferences.
To do this just a smal change in the documentation in the Methodology is requiered.
This is some background research on this
I started to check what has been implemented in the tool. I only found a rule checking that if a targetClass attribute exists it must point to an existing class in the model, nothing else. I also tested to generate a schema where I have removed the targetClass attribute from relatedSituation. No warnings reported and the schema validates. The relatedSituiation is using the untyped VersionedReference type.
So, no problem here to use the untyped Referene and VersionReferenced types.
Then I looked in the Methodology document and found
Furthermore, corresponding (typed!) referencing types are created, that allow to refer to elements of these types, based on common untyped reference types (“Reference” & “VersionedReference”).
<xs:complexType name="Reference">
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
and
<xs:complexType name="VersionedReference">
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string" use="required"/>
</xs:complexType>
Depending on whether the target type for a class {targetClass} is versioned or not, the corresponding reference type looks like this
<xs:complexType name=”_”{targetClass}"Reference">
<xs:complexContent>
<xs:extension base="D2LogicalModel:Reference">
<xs:attribute name="targetClass" use="required" fixed={targetClass}/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
or like this
<xs:complexType name=”_”{targetClass}"VersionedReference">
<xs:complexContent>
<xs:extension base="D2LogicalModel:VersionedReference">
<xs:attribute name="targetClass" use="required" fixed={targetClass}/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
The {targetClass} is determined by setting a “targetClass” tagged value on the attribute that implements the reference!
--
There I cannot see anything about not using the untyped types.
But at clause 5.2.5 we do have a problem
UML Attributes shall have an assigned “type” element. The assigned type shall be a UML Class with UML Stereotype “datatype” (Note that built-in UML types are not allowed.) or it shall be a UML Enumeration. If the assigned type is either “Reference” or “VersionedReference”, the UML Attribute shall have a “targetClass” UML TaggedValue, which shall provide a name of a UML Class that has an “identifiable” or “versionedIdentifiable” Stereotype assigned, respectively.
As we have a need for untyped References in the new exchange I would propose to change the shall to could in the clause above for version 3.0. As the new exchange will require version 3.0 anyway I don’t see that it would be a problem to use untyped Reference and VersionReferenced types. (as long as the change to 5.2.5 will be in the next version)
#1
#2
Forcing typed references and not allowing generic references was an error in the Methodology. The corresponding clause in the Methodology (5.2.5) has been corrected from shall to may, so both options are available and lead to either a typed or a generic reference. A respective clarification has been added to clause 4.4 (Mapping of "D2Identifiable" classes). The fix is published in version 2.3.
#3