General (#1) - OCL escape character (#19) - Message List

OCL escape character

The OCL specifications states that keywords in OCL are reserved in section 7.4.9. However it seems impossible to escape from these reserved keywords.

Imagine having a class with a property named context (i.e. QVT::MappingOperation) then the following OCL is expression is invalid MappingOperation.allInstances().context

The eclipse project has run into the same problem and solved it as you can see here:

Has mediniQVT any such capability at hand?

  • Message #46

    Found this issue in section 9.3 of the ocl spec. Escape character is '_' .

    • Message #47

      It seems that this character is not honored by the engine. evaluating "MappingOperation._context" results in errors during evaluation as the property cannot be found.

      In OclModelElementTypeImpl.lookupProperty(String name) the following lines do the trick (50-52):

      if(prop == null && name.startsWith("_")) {
        prop = (Property) this._properties.get(name.substring(1));

      Can someone share some insight with me if this is really a bug?

      • Message #48

        This is a bug, which is fixed today (in the same method as you proposed, please update per SVN and see..). Thanks!


No attachments created.