Sample OCL
self.parameter->operation(param) self.child->isTypeOf(TypeName) self <> self.child self.one and self.two not(self.name = '')
For OCL strings, they must be in single quotes. Double quotes (") and backticks (`) do not work.
Sample OCL in .gmfmap
self.oclIsTypeOf(TypeName)
Using packages in OCL
I had an object, UserStore, which was in a separate package to the root. I was trying to use the following OCL constraint in my GMF .gmfmap:self.oclIsTypeOf( DomainStore ) and not self.oclIsTypeOf( UserStore )
However, I was getting the following validation error:
Invalid expression body '...'. Cause: Unrecognized variable: (UserStore)
The problem is because the new type is in a separate package. The solution is to use the :: operator as a package separator, i.e.:
self.oclIsTypeOf( DomainStore ) and not self.oclIsTypeOf( users::UserStore )