Search code examples
umlxmi

Mapping dot notation in XMI


Since 2.1 (or so) UML has introduced the so-called dot-notation which tells whether the role name besides the dot at an association end denotes an owned property within the opposite class. Since 2.5 OMG makes quite extensive use of that notation.

Now I wonder how this shall be mapped to XMI. The UML spec states on p. 717

UMLEdge (Association/Connector/InstanceSpecification/Property/ConnectorEnd , isAssociationDotShown enabled)

So I would expect to have an attribute in XMI like

<ownedEnd isAssociationDotShown="true" xmi:type="uml:Property" ...

I tried that in Enterprise Architect, but (no wonder) it did not work. EA is using it's own extension

<style value="Union=0;Derived=0;AllowDuplicates=0;Navigable=Unspecified;Owned=1;"/>

(it's the Owned=1 at the end). Of course I could mimic that notation, but

  1. that would only work for EA and
  2. I'd like to stick to a standard which I
  3. like to digest since I'm just guessing here.

Solution

  • The property isAssociationDotShown is a property of UmlDiagramWithAssociations (UML 2.5 § B.7.15) in the Annex B UML Diagram Interchange and is described as

    isAssociationDotShown : Boolean [1..1] = false
    Indicates whether dot notation for associations shall be used.

    Notice that by default this property is false, which means the diagram should not show association dots.

    The dot notation itself is defined in UML (UML 2.5 § 11.5.4) as

    Ownership of Association ends by an associated Classifier may be indicated graphically by a small filled circle, which for brevity we will term a dot.

    The mapping to XMI is really nothing more then the ownership of the member ends of the association.

    Example from the UML specs: enter image description here

    Example 1: Dot on both sides

    The association in between InteractionFragment and Interaction has a dot on both sides, indicating that both ends are owned by the opposite classifier.
    And indeed in the xmi provided by the OMG we find:

    <packagedElement xmi:type="uml:Association" xmi:id="A_fragment_enclosingInteraction" name="A_fragment_enclosingInteraction" memberEnd="Interaction-fragment InteractionFragment-enclosingInteraction"/>
    

    without owned ends. Both end are owned by the classifiers at the ends as OwnedAttributes

    <ownedAttribute xmi:type="uml:Property" xmi:id="Interaction-fragment" name="fragment" type="InteractionFragment" isOrdered="true" aggregation="composite" subsettedProperty="Namespace-ownedMember" association="A_fragment_enclosingInteraction">
        <ownedComment xmi:type="uml:Comment" xmi:id="Interaction-fragment-_ownedComment.0" annotatedElement="Interaction-fragment">
            <body>The ordered set of fragments in the Interaction.</body>
        </ownedComment>
        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="Interaction-fragment-_upperValue" value="*"/>
        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="Interaction-fragment-_lowerValue"/>
    </ownedAttribute>
    

    And the other one:

    <ownedAttribute xmi:type="uml:Property" xmi:id="InteractionFragment-enclosingInteraction" name="enclosingInteraction" type="Interaction" subsettedProperty="NamedElement-namespace" association="A_fragment_enclosingInteraction">
        <ownedComment xmi:type="uml:Comment" xmi:id="InteractionFragment-enclosingInteraction-_ownedComment.0" annotatedElement="InteractionFragment-enclosingInteraction">
            <body>The Interaction enclosing this InteractionFragment.</body>
        </ownedComment>
        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="InteractionFragment-enclosingInteraction-_lowerValue"/>
    </ownedAttribute>
    

    Example 2: Dot on one side

    The association between StateInvariant and Constraint only has a dot on the Constraint end
    The association itself is defined in the XMI as:

    <packagedElement xmi:type="uml:Association" xmi:id="A_invariant_stateInvariant" name="A_invariant_stateInvariant" memberEnd="StateInvariant-invariant A_invariant_stateInvariant-stateInvariant">
        <ownedEnd xmi:type="uml:Property" xmi:id="A_invariant_stateInvariant-stateInvariant" name="stateInvariant" type="StateInvariant" subsettedProperty="Element-owner" association="A_invariant_stateInvariant">
            <lowerValue xmi:type="uml:LiteralInteger" xmi:id="A_invariant_stateInvariant-stateInvariant-_lowerValue"/>
        </ownedEnd>
    </packagedElement>
    

    The end without the dot is owned by the association.
    The end with the dot is owned by StateInvariant as ownedAttribute.

    <ownedAttribute xmi:type="uml:Property" xmi:id="StateInvariant-invariant" name="invariant" type="Constraint" aggregation="composite" subsettedProperty="Element-ownedElement" association="A_invariant_stateInvariant">
        <ownedComment xmi:type="uml:Comment" xmi:id="StateInvariant-invariant-_ownedComment.0" annotatedElement="StateInvariant-invariant">
            <body>A Constraint that should hold at runtime for this StateInvariant.</body>
        </ownedComment>
    </ownedAttribute>
    

    Importing into EA

    Unfortunately there seems to be a bug in the xmi import function in EA as it looses the notion of owned ends (and so the dots). When importing it into EA (v14.5 BETA) the result is:

    enter image description here