UML 2.4 RTF Avatar
  1. OMG Issue

UML24 — UML 2.4: Inconsistent rendering of OCL in UML metamodel

  • Key: UML24-71
  • Legacy Issue Number: 15378
  • Status: closed  
  • Source: Model Driven Solutions ( Mr. Steve Cook)
  • Summary:

    This is a UML 2.4 issue please:

    Inconsistent rendering of OCL in UML metamodel.

    According to the conventions mostly applied in the UML metamodel, the specifications of the body conditions of operations have the form “result = <OCL expression>” and the operation is specified to have a return parameter named “result”. Invariants, pre- and post-conditions, on the other hand, are simply Boolean expressions with no “result = “. Note that many invariants are specified in OCL as “true”, being placeholders for invariants that are currently only specified in text. There are some placeholder operations, for which the specification should be “result = <default value for the type of result>”, i.e. result = false, result = 0, or result = null.

    Applying these conventions consistently will greatly enable future generation of specification documents. This means making the following changes:

    All operations in the metamodel should be changed to have a return parameter named “result”.

    The following operation and constraint specifications should be changed as indicated by changeto:


    “hasVisibilityOf = (n.visibility <> VisibilityKind::private)” changeto “result = (n.visibility <> VisibilityKind::private)”


    “self.inheritedMember->includesAll(self.inherit(self.parents()>collect(p|p.inheritableMembers(self))>asSet()))” changeto “result = self.inherit(self.parents()>collect(p|p.inheritableMembers(self))>asSet())”


    “hasVisibilityOf = (n.visibility <> VisibilityKind::private)” changeto “result = (n.visibility <> VisibilityKind::private)”


    “self.inheritedMember->includesAll(self.inherit(self.parents()>collect(p|p.inheritableMembers(self))>asSet()))” changeto “result = self.inherit(self.parents()>collect(p|p.inheritableMembers(self))>asSet())”


    “true” changeto “result = 0”


    “pre: not vis->includes(#protected) and not vis->includes(#package)” changeto “not vis->includes(#protected) and not vis->includes(#package)”


    “result = self.deployment->forAll (d | d.location..oclIsKindOf(ExecutionEnvironment))” changeto “self.deployment->forAll (d | d.location.oclIsKindOf(ExecutionEnvironment))”


    “result = self.endType->forAll (t | t.oclIsKindOf(DeploymentTarget))” changeto “self.endType->forAll (t | t.oclIsKindOf(DeploymentTarget))”


    Two placeholder invariants specified as “N/A” –changeto- “true”


    “true” – changeto- “result = null”

  • Reported: UML 2.3 — Wed, 21 Jul 2010 04:00 GMT
  • Disposition: Resolved — UML 2.4
  • Disposition Summary:

    Agree to the changes proposed in the summary, except for OpaqueExpression::value() and StateMachine::LCA(). For these operations the result is undefined so it is incorrect to return a defined result. Instead a body of true is actually correct: it is logically equivalent to result=result.

  • Updated: Fri, 6 Mar 2015 20:58 GMT