Issue 16686: Error in CreateLinkAction semantics (fuml-rtf) Source: Model Driven Solutions (Mr. Ed Seidewitz, ed-s(at)modeldriven.com) Nature: Uncategorized Issue Severity: Summary: Specification: Semantics of a Foundational Subset for Executable UML Models (fUML), v1.0 (formal/2011-02-01) Subclause: 8.6.3.x CreateLinkActionActivation In Subclause 8.6.3.1 (Overview), under “Link Actions”, it says for a Create Link Action that “if a link already exists in the association extent with the same tuple of values, and all the ends of the association are specified as unique, then no new link is actually created (though this is not an error).” However, the specification for CreateLinkActionActivation::doAction in Subclause 8.6.3.2.4 always creates a new link even if an identical link already exists (unless isReplaceAll=true for one of the ends), regardless of whether the ends of the association are all unique. Resolution: Agreed. Actually it is OK to always create a new link, as long as a link with all matching ends is destroyed first in the case of an association with all ends unique, since links with matching ends are not distinguishable Revised Text: In Subclause 8.6.3.4, in doAction, add the following to the initial comment block, before the first sentence: // If the association has any unique ends, then destroy an existing link // that matches all ends of the link being created. Replace the statement “Link oldLink = null;” and the following for loop with: boolean unique = false; for (int i = 0; i < endDataList.size(); i++) { if (endDataList.getValue(i).end.multiplicityElement.isUnique) { unique = true; } } for (int i = 0; i < extent.size(); i++) { ExtensionalValue value = extent.getValue(i); Link link = (Link) value; boolean match = true; boolean destroy = false; int j = 1; while (j <= endDataList.size()) { LinkEndCreationData endData = endDataList.getValue(j - 1); if (this.endMatchesEndData(link, endData)) { if (endData.isReplaceAll) { destroy = true; } } else { match = false; } j = j + 1; } if (destroy | unique & match ) { link.destroy(); } } In the subsequent for loop, remove the following if statement: if (oldLink != null) { if (oldLink.getFeatureValue(endData.end).position < insertAt) { insertAt = insertAt - 1; } } Actions taken: November 14, 2011: received issue January 7, 2013: closed issue Discussion: End of Annotations:===== m: Ed Seidewitz To: "issues@omg.org" Date: Mon, 14 Nov 2011 18:15:27 -0500 Subject: Error in CreateLinkAction semantics Thread-Topic: Error in CreateLinkAction semantics Thread-Index: AcyjI0to2lQwMLI0RYmc6xiVG7xaqg== Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US X-Mailprotector-Decision: deliver X-Mailprotector-Connection: TLSv1|[10.1.50.226]|10.1.50.226|outbound.mailprotector.net|-0.984877|0.789085|0|white|ugly|2100|16|0|0 X-Mailprotector-Results: null_ptr clean X-Mailprotector-Score: 40 X-Mailprotector-IP-Analysis: 0, 10.1.50.226, Ugly c=0.789085 p=-0.984877 Source White X-Mailprotector-Scan-Diagnostics: 0-0-0-6266-c Specification: Semantics of a Foundational Subset for Executable UML Models (fUML), v1.0 (formal/2011-02-01) Subclause: 8.6.3.x CreateLinkActionActivation In Subclause 8.6.3.1 (Overview), under .Link Actions., it says for a Create Link Action that .if a link already exists in the association extent with the same tuple of values, and all the ends of the association are specified as unique, then no new link is actually created (though this is not an error).. However, the specification for CreateLinkActionActivation::doAction in Subclause 8.6.3.2.4 always creates a new link even if an identical link already exists (unless isReplaceAll=true for one of the ends), regardless of whether the ends of the association are all unique.