OCL 2.5 RTF Avatar
  1. OMG Issue

OCL25 — OCL 2.2 UML-alignment of redefinition

  • Key: OCL25-10
  • Legacy Issue Number: 15218
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    At the end of Section 7.4.6 OCL 2.2 says

    "For example, if class Employee redefines the age() : Integer operation of
    the Person class, a constraint may access the
    Person definition as in
    context Employee
    inv: self.age() <= self.Person::age()
    For clarity, the qualified form may only be used with an explicit source
    expression."

    and in Section 7.5.8:

    "Whenever properties are redefined within a type, the property of the
    supertypes can be accessed using the oclAsType()
    operation. Whenever we have a class B as a subtype of class A, and a
    property p1 of both A and B, we can write:"

    a clarifying example follows that is actually a disambiguation not a
    redefinition.

    In UML redefinition replaces an old definition with something else, which is
    not what the above
    excerpts imply.

    In the case of redefining "Person::age() : Integer". If the redefinition is
    "Employee::age() : UnlimitedNatural"
    the redefinition is compatible (valid UML), so perhaps self.age() being
    UnlimitedNatural and self.Person::age()
    being Integer just might be useful. But allowing them to invoke different
    operation bodies seems to violate
    UML.

    Suggest that use of a path qualification may select an occluded definition
    signature for static analysis,
    but may not use a redefined value or body.

    [This then avoids a need for the AST to persist the distinction between X::y
    as an explicit feature for
    static resolution or as an implicit feature for dynamic resolution. All
    features in the AST are identified by
    static analysis and evaluated by dynamic resolution.]

  • Reported: OCL 2.1 — Thu, 22 Apr 2010 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:11 GMT