Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL query failing for the 'matches' function of String
OCL query failing for the 'matches' function of String [message #1451313] Thu, 23 October 2014 16:48 Go to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hi all,

I try to look for CDO resources using an OCL query based on a regular expression.

The following query works fine :
eresource::CDOResource.allInstances()->select(r:eresource::CDOResource | r.name='security')


Whereas the one using the 'matches' function fails :
eresource::CDOResource.allInstances()->select(r:eresource::CDOResource | r.name.matches('security'))


All I get, is the following error message with no more details in the log file :
OCL query evaluated to 'invalid'. Run with '-Dorg.eclipse.ocl.debug=true' and visit the log for failure details.


Any idea why this is happening ?

Kind regards,

Laurent
Re: OCL query failing for the 'matches' function of String [message #1451693 is a reply to message #1451313] Fri, 24 October 2014 06:41 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You probably have a resource with a null name, so r.name.matches behaves
rather like Java; you get an invalid (NPE).

Try r.name <> null and ...

OCL 2.5 may introduce a safe navigation operator.

Regards

Ed Willink

On 23/10/2014 17:49, Laurent Le Moux wrote:
> Hi all,
>
> I try to look for CDO resources using an OCL query based on a regular
> expression.
>
> The following query works fine :
>
> eresource::CDOResource.allInstances()->select(r:eresource::CDOResource |
> r.name='security')
>
>
> Whereas the one using the 'matches' function fails :
>
> eresource::CDOResource.allInstances()->select(r:eresource::CDOResource |
> r.name.matches('security'))
>
>
> All I get, is the following error message with no more details in the
> log file :
>
> OCL query evaluated to 'invalid'. Run with
> '-Dorg.eclipse.ocl.debug=true' and visit the log for failure details.
>
>
> Any idea why this is happening ?
>
> Kind regards,
>
> Laurent
Re: OCL query failing for the 'matches' function of String [message #1451752 is a reply to message #1451693] Fri, 24 October 2014 08:38 Go to previous message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
That was it ! Many thanks for your help !
Previous Topic:inter-models OCLs
Next Topic:[Luna] Package not registered in standalone
Goto Forum:
  


Current Time: Fri Apr 19 10:31:31 GMT 2024

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

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

Back to the top