OCL Expression Tracing (Professional Edition only)

In this section, you will trace OCL expressions. There's also a flash tutorial on this issue.

OCL definition

  1. In the Project Explorer view in the OCL perspective, double-click deflib.oclx to open it in an editor.
  2. Mark the definition getClassByName, select Trace OCL from the context menu. A list of available models is displayed.
  3. Select the model models.new_file.uml on which you want to trace the definition and select the model element Model::Unknown.

    OCL definition tracing

  4. An input dialog for the required parameters String:aName is displayed. Type C2 into the input field and press the OK button.

    OCL definition tracing dialog

  5. The definition is evaluated in the context of the selected model element. The evaluation result is displayed in the console.

    OCL definition tracing result

  6. As expected, the result of the OCL definition tracing is the Class::C2.

OCL query

  1. In the Project Explorer view in the OCL perspective, double-click querylib.oclx to open it in an editor.
  2. Mark the query numberOfAttributes, select Trace OCL from the context menu. A list of available models is displayed.
  3. Select the model models.new_file.uml on which you want to trace the query and select the model element Class::C2.

    OCL query tracing

  4. The query is evaluated in the context of the selected model element. All evaluation steps and results are displayed in the console.

    OCL query tracing result

OCL test

  1. In the Project Explorer view in the OCL perspective, double-click testlib.oclx to open it in an editor.
  2. Mark the query numberOfAttributesC2, select Trace OCL from the context menu and finally select the model models.new_file.uml on which you want to trace the test.

    OCL test tracing

  3. The test is evaluated in the context of the selected model. All evaluation steps and results are displayed in the console.

    OCL query tracing result