Issue 16576: B.6 Identification (canonical-xmi-ftf) Source: NASA (Dr. Nicolas F. Rouquette, nicolas.f.rouquette(at)jpl.nasa.gov) Nature: Uncategorized Issue Severity: Summary: The rule in the second bullet is insufficient to guarantee stable generation of xmi:id values. Consider the following excerpt from UML2.4.1's XMI (http://www.omg.org/spec/UML/20101101/UML.xmi) <packagedElement xmi:type="uml:Class" xmi:id="Namespace" name="Namespace" isAbstract="true"> ... <ownedAttribute xmi:type="uml:Property" xmi:id="Namespace-importedMember" name="importedMember" visibility="public" type="PackageableElement" isReadOnly="true" isDerived="true" subsettedProperty="Namespace-member" association="A_importedMember_namespace"> <ownedComment xmi:type="uml:Comment" xmi:id="Namespace-importedMember-_ownedComment.0" annotatedElement="Namespace-importedMember"> <body>References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports.</body> </ownedComment> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="Namespace-importedMember-_upperValue" value="*"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="Namespace-importedMember-_lowerValue"/> </ownedAttribute> ... <ownedAttribute xmi:type="uml:Property" xmi:id="Namespace-ownedMember" name="ownedMember" visibility="public" type="NamedElement" isReadOnly="true" isDerived="true" isDerivedUnion="true" aggregation="composite" subsettedProperty="Namespace-member Element-ownedElement" association="A_ownedMember_namespace"> <ownedComment xmi:type="uml:Comment" xmi:id="Namespace-ownedMember-_ownedComment.0" annotatedElement="Namespace-ownedMember"> <body>A collection of NamedElements owned by the Namespace.</body> </ownedComment> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="Namespace-ownedMember-_upperValue" value="*"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="Namespace-ownedMember-_lowerValue"/> </ownedAttribute> ... <ownedOperation xmi:type="uml:Operation" xmi:id="Namespace-importedMember.1" name="importedMember" visibility="public" isQuery="true" bodyCondition="Namespace-importedMember.1-spec"> <ownedComment xmi:type="uml:Comment" xmi:id="Namespace-importedMember.1-_ownedComment.0" annotatedElement="Namespace-importedMember.1"> <body>The importedMember property is derived from the ElementImports and the PackageImports. References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports.</body> </ownedComment> <ownedRule xmi:type="uml:Constraint" xmi:id="Namespace-importedMember.1-spec" name="spec" constrainedElement="Namespace-importedMember.1 Namespace-importedMember"> <specification xmi:type="uml:OpaqueExpression" xmi:id="Namespace-importedMember.1-spec-_specification"> <language>OCL</language> <body>result = self.importMembers(self.elementImport.importedElement.asSet()- &gt;union(self.packageImport.importedPackage-&gt;collect(p | p.visibleMembers())))</body> </specification> </ownedRule> <ownedParameter xmi:type="uml:Parameter" xmi:id="Namespace-importedMember.1-result" name="result" visibility="public" type="PackageableElement" direction="return"> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="Namespace-importedMember.1-result-_upperValue" value="*"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="Namespace-importedMember.1-result-_lowerValue"/> </ownedParameter> </ownedOperation> ... <ownedOperation xmi:type="uml:Operation" xmi:id="Namespace-ownedMember.1" name="ownedMember" visibility="public" isQuery="true" bodyCondition="Namespace-ownedMember.1-spec"> <ownedComment xmi:type="uml:Comment" xmi:id="Namespace-ownedMember.1-_ownedComment.0" annotatedElement="Namespace-ownedMember.1"> <body>Missing derivation for Namespace::/ownedMember : NamedElement</body> </ownedComment> <ownedRule xmi:type="uml:Constraint" xmi:id="Namespace-ownedMember.1-spec" name="spec" constrainedElement="Namespace-ownedMember.1 Namespace-ownedMember"> <specification xmi:type="uml:OpaqueExpression" xmi:id="Namespace-ownedMember.1-spec-_specification"> <language>OCL</language> <body>true</body> </specification> </ownedRule> <ownedParameter xmi:type="uml:Parameter" xmi:id="Namespace-ownedMember.1-result" name="result" visibility="public" type="NamedElement" direction="return"> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="Namespace-ownedMember.1-result-_upperValue" value="*"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="Namespace-ownedMember.1-result-_lowerValue"/> </ownedParameter> </ownedOperation> </packagedElement> UML::Operation is an instance of the metaclass: UML::Class, which has several properties including: - ownedAttribute: importedMember, ownedMember - ownedOperation: importedMember, ownedMember The rule in B5.1 seems incomplete. It should specify that for a given element (e.g., UML::Operation as above), then nested elements are ordered alphabetically by the name of the meta-property. In the above example, UML::Operation has metaclass UML::Class; whose meta-properties include, in alphabetical order, UML::Class::ownedAttribute and UML::Class::ownedOperation. The alphabetical ordering of these meta-properties is used for serializing the values of these metaproperties but also for generating their xmi:ids as well. That's why the ownedAttribute UML::Operation::importedMember has xmi:id="Namespace-importedMember" whereas the ownedOperation UML::Operation::importedMember has xmi:id="Namespace-importedMember.1" In particular, the last sentence in the 2nd bullet of B6 is incorrect: Note that named elements (which satisfy the first rule) are still included in this count. That is, the "-<N>" suffix starts with N=1 when the generated xmi:id would otherwise conflict with a previously generated xmi:id; that is, N=2 corresponds to the second element that has the same qualified name; N=3 corresponds to the third, etc... Resolution: Revised Text: Actions taken: August 28, 2011: received issue December 23, 2013: closed issue Discussion: Rules B5.1 is only about "top level elements in the XMI file (direct descendants of the XMI element)". For the example in the issue "It should specify that for a given element (e.g., UML::Operation as above), then nested elements are ordered alphabetically by the name of the meta-property." that is covered by rule B5.2 which states that "The order of the XML elements for Properties is order of the properties for the class in the metamodel." Disposition: Closed, no change End of Annotations:===== s is issue # 16576 nicolas.f.rouquette@jpl.nasa.gov B.6 Identification The rule in the second bullet is insufficient to guarantee stable generation of xmi:id values. Consider the following excerpt from UML2.4.1's XMI (http://www.omg.org/spec/UML/20101101/UML.xmi) ... References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. ... A collection of NamedElements owned by the Namespace. ... The importedMember property is derived from the ElementImports and the PackageImports. References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. OCL result = self.importMembers(self.elementImport.importedElement.asSet()- >union(self.packageImport.importedPackage->collect(p | p.visibleMembers()))) ... Missing derivation for Namespace::/ownedMember : NamedElement OCL true UML::Operation is an instance of the metaclass: UML::Class, which has several properties including: - ownedAttribute: importedMember, ownedMember - ownedOperation: importedMember, ownedMember The rule in B5.1 seems incomplete. It should specify that for a given element (e.g., UML::Operation as above), then nested elements are ordered alphabetically by the name of the meta-property. In the above example, UML::Operation has metaclass UML::Class; whose meta-properties include, in alphabetical order, UML::Class::ownedAttribute and UML::Class::ownedOperation. The alphabetical ordering of these meta-properties is used for serializing the values of these metaproperties but also for generating their xmi:ids as well. That's why the ownedAttribute UML::Operation::importedMember has xmi:id="Namespace-importedMember" whereas the ownedOperation UML::Operation::importedMember has xmi:id="Namespace-importedMember.1" In particular, the last sentence in the 2nd bullet of B6 is incorrect: Note that named elements (which satisfy the first rule) are still included in this count. That is, the "-" suffix starts with N=1 when the generated xmi:id would otherwise conflict with a previously generated xmi:id; that is, N=2 corresponds to the second element that has the same qualified name; N=3 corresponds to the third, etc...