Search code examples
eclipseeclipse-pluginemfocl

Setting context and inv in interactive OCL console


I am using the Eclipse Interactive OCL console to test the OCL examples from this document. For testing, the example(Tutorial.xmi) provided with the link is used. The tried expressions are given below.

Evaluating:
self.name
Results:
'tutorial'

Evaluating:
context Book
Results:
2:1:2:7 "context" unexpected token(s)

Evaluating:
context Book inv:self.name
Results:
1:1:1:4 "inv:" misplaced construct(s)

Here the changes in context always shows error. Also whenever I specify inv, the same "misplaces constructs" message is shown.


Solution

  • The Eclipse OCL Console evaluates OCL expressions such as "self.name", not Complete OCL constructs such as "context Book inv:self.name". The context is taken from the prevailing mouse selection, which might be an EClass in a Sample Ecore Editor.

    Why are you using the 5.0.0 documentation? It is over 4 years old.