Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Problems with nested exists
Problems with nested exists [message #1058139] Sun, 12 May 2013 12:41 Go to next message
Bernhard Berger is currently offline Bernhard Berger
Messages: 5
Registered: October 2011
Junior Member
Hi,

I have some trouble with some OCL expressions I want to evaluate using Pivot. For writing the expressions I am using the Xtext OCL console and I am ending up with a "Evaluation failure" I do not understand.

The problem -as far as I reduced it- originates from two nested exists where the inner tries to access the variable of the outer exists. Starting from an arbitrary ecore file I open the "Xtext OCL console" for a class with some attributes (for instance the Book class in extlibrary example) then I enter the following expression:

eStructuralFeatures->exists(feature | Set{true}->exists(data | feature.name = ''))

The interpreter then prints:
Evaluation failure
Invalid source for '='

The = is not related to the = in the expression. I'm aware that the code is semantically useless but the original query is longer.

The "Interactice OCL console" returns a boolean value instead of throwing an error. Is it a bug in the Xtext OCL console

Thanks in advance and regards,
Bernhard
Re: Problems with nested exists [message #1058143 is a reply to message #1058139] Sun, 12 May 2013 13:55 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

Thanks. https://bugs.eclipse.org/bugs/show_bug.cgi?id=407817 raised.

The current code returns

'NavigableObject' rather than 'Boolean' value required

presumably because the inner 'feature' reference has been resolved to
the Boolean inner 'data' rather than the Object outer 'feature'.

Regards

Ed Willink

On 12/05/2013 13:41, Bernhard Berger wrote:
> Hi,
>
> I have some trouble with some OCL expressions I want to evaluate using
> Pivot. For writing the expressions I am using the Xtext OCL console
> and I am ending up with a "Evaluation failure" I do not understand.
>
> The problem -as far as I reduced it- originates from two nested exists
> where the inner tries to access the variable of the outer exists.
> Starting from an arbitrary ecore file I open the "Xtext OCL console"
> for a class with some attributes (for instance the Book class in
> extlibrary example) then I enter the following expression:
>
> eStructuralFeatures->exists(feature | Set{true}->exists(data |
> feature.name = ''))
> The interpreter then prints:
> Evaluation failure
> Invalid source for '='
> The = is not related to the = in the expression. I'm aware that the
> code is semantically useless but the original query is longer.
>
> The "Interactice OCL console" returns a boolean value instead of
> throwing an error. Is it a bug in the Xtext OCL console
>
> Thanks in advance and regards,
> Bernhard
Previous Topic:[OCLinEcore][bug?] @pre tag and isPre() method not working properly
Next Topic:OCL to validate XML models?
Goto Forum:
  


Current Time: Tue Sep 23 00:28:09 GMT 2014

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

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