Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Problems with Context Identifier(Problems with Context Identifier)
Problems with Context Identifier [message #1487285] Tue, 25 November 2014 18:32
Nils Przigoda is currently offline Nils PrzigodaFriend
Messages: 14
Registered: September 2013
Location: Bremen, Germany
Junior Member
Hi everyone,

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)
 at org.eclipse.ocl.util.OCLUtil.checkForErrors(OCLUtil.java:358)


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

or
 context a: A, b: B inv name: a.value >= b.value


Edit:
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.

Regards,
Nils

[Updated on: Tue, 25 November 2014 19:39]

Report message to a moderator

Previous Topic:Announcing Eclipse OCL 5.0.3 for Luna
Next Topic:Problem with Generated editor and ocl constraints
Goto Forum:
  


Current Time: Thu Apr 25 19:54:18 GMT 2024

Powered by FUDForum. Page generated in 0.03051 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top