|Problems with Context Identifier [message #1487285]
||Tue, 25 November 2014 18:32
| Nils Przigoda
Registered: September 2013
Location: Bremen, Germany
I have a (hopefully) very small problem with the context identifier in invariants. If I simply use the following OCL code, everything works fine:
context Counter inv bound: self.value > 0
But if I add an identifier for the class which should be not self, I get problems:
context c : Counter inv bound: self.value > 0
This is marked as faulty code with an error message in the OCL editor:
mismatched input 'inv' expecting 'endpackage'.
But I'm asking myself now, what is self? Is it always declared?
Funnily the last line is parsed without any problems and my program behind is also working fine...
But as I was looking forward to
context c : Counter inv bound: c.value > 0
I also tried this code, with the following exception result:
org.eclipse.ocl.SemanticException: Unrecognized variable: (c)
I looked at the OMG spec for context and think that my code should be fine, but I was not able to check, if such changed identifiers are also supported by ecore+OCL. Can someone tell me, if this is supported? And if yes, also give me a short example. If not, I would like to know where to find this information, because I could not find anything with google or inside this forum. Maybe I'm blind or I've used the wrong keywords.
A last question, if identifiers as given above are supported, is it also possible to use snippets like:
context a1: A, a2: A inv name: a1.value >= a2.value
context a: A, b: B inv name: a.value >= b.value
I forgot to say that I'm using Eclipse Kepler SR 2 (Eclipse Modeling Tools)
If I forget any further information, please let me know.
[Updated on: Tue, 25 November 2014 19:39]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02271 seconds