UML 2.3 RTF Avatar
  1. OMG Issue

UML23 — Validator issues with TestCase 2

  • Key: UML23-65
  • Legacy Issue Number: 13930
  • Status: closed  
  • Source: NIST ( Mr. Peter Denno)
  • Summary:

    looked at the 7 OCL constraint failures reported in Test Case 2. There are 5 different kinds of constraints that failed. In summary I found:

    • In 2 of these it appears that the model, valid.xmi, is wrong.
    • In 2 the OCL is wrong. One can be fixed. The other should be removed from the UML spec.
    • In 1 I made a mistake when correcting an unrelated problem in the OCL.

    I'll update the Validator. If my conclusions below are correct, someone should update valid.xmi too.

    Details below:

    (Model 'TestCase2')
    Summary of Model Content:
    Total objects: 94.
    UML objects: 94
    SysML objects: 0
    The model: <uml:Model TestCase2, id=1>
    Object Inventory
    Summary of Warnings:

    • Referent not found: 0
    • Unresolved URI used for object identification: 0
    • Set members not unique: 0
    • Missing mandatory value: 0
    • No class with name specified: 0
    • Property not found: 0
    • Cannot infer class of object: 0
    • Multiplicity violation: 0
    • Type violation: 0
    • Invalid stereotype application: 0
    • No object for stereotyping: 0
    • Creation of abstract class: 0
    • OCL constraint violation: 7 <================
    • OCL execution errors: 3
    • OCL errors while evaluating derived attribute: 0
    • OCL errors due to missing derived attribute specifications: 315
    • Identical XMI attribute xmi:id used by multiple XML elements: 0
    • Expected a uml:PrimitiveType: 0
    • XMI attribute xmi:id references excessive space chars: 0

    OCL constraint violation (7)
    There are 5 variations of this error:

    1 instances of this:
    The constraint Property.redefined_property_inherited() was violated.
    View Instance 1

    2 instances of this:
    The constraint NamedElement.has_no_qualified_name() was violated.
    View Instance 1

    1 instances of this:
    The constraint Constraint.value_specification_boolean() was violated.
    View Instance 1

    1 instances of this:
    The constraint Interface.visibility() was violated.
    View Instance 1

    2 instances of this:
    The constraint RedefinableElement.redefinition_context_valid() was violated.
    View Instance 1

    The constraint Property.redefined_property_inherited() was violated.
    This one on instance 84, a Property named "redefiningProperty"

    The constraint is:
    redefinedProperty->notEmpty() implies
    redefinitionContext->notEmpty() and
    redefinedProperty->forAll(rp|redefinitionContext->
    collect(fc | fc.allParents())>asSet()>
    collect(c| c.allFeatures())>asSet()>includes(rp))

    ... 84.redefinedProperty is not empty, but 84.redefinitionContext is empty.

    In as far as this constraint is what was intended, the validator is doing the right thing. The file should specify a redefinition context. If you believe the contraint or my conclusion is incorrect, let me know. Otherwise, shall I'll write an issue against the testcase?

    The constraint Interface.visibility() was violated.
    This one on instance 29:

    The constraint is:
    self.feature->forAll(f | f.visibility = #public)

    self.feature contains one instance, named "operation1", and its visibility is not set. In as far as this constraint is what was intended, the validator is doing the right thing. If you believe the constraint or my conclusion is incorrect, let me know.

    The constraint NamedElement.has_no_qualified_name() was violated.

    This one is my mistake. I corrected an error in the derivation of qualified names, and in an unrelated act, placed that "self.name" text before the endif below. It was Set{} and should be Set{}. I'll fix the OCL in Validator and put out a new version.

    result = if self.name->notEmpty() and
    self.allNamespaces()>select(ns | ns.name>isEmpty())->isEmpty()
    then self.allNamespaces()->iterate( ns : Namespace;
    result : String = self.name | ns.name.concat(self.separator()).concat(result))
    else self.name endif <=== should be Set{}

    The constraint Constraint.value_specification_boolean() was violated.

    The constraint is:
    self.specification.booleanValue().oclIsKindOf(Boolean)

    The function booleanValue():
    result = value

    It looks like this intends to perform runtime evaluation of the OCL string in the specification property (which should more accurately be specification.body, anyway). Technically, I could do this, but there is no way to describe the evaluation in OCL, and I wouldn't really want to execute arbitrary code on my server.

    I will mark this OCL as an error, and have it return True. This OCL should be removed from the UML spec.

    The constraint RedefinableElement.redefinition_context_valid() was violated.

    After some digging I found that the definition of isRedefinitionContextValid, which is called by this was:

    redefinitionContext->
    exists(c | c.allParents()->
    includes(redefined.redefinitionContext))

    But redefined.redefinitionContext is a Collection, so the use of includes here is not correct. It should be:

    redefinitionContext->
    exists(c | c.allParents()->
    oclIntersection(redefined.redefinitionContext)->notEmpty())

    Things work fine with this correction.

  • Reported: UML 2.2 — Tue, 12 May 2009 04:00 GMT
  • Disposition: Resolved — UML 2.3
  • Disposition Summary:

    The problems highlighted by the issue have already been resolved in the specification.
    Disposition: Closed - No Change

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