Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Unresolved operation '<' for 'Ecore::ecore::EInt'
Unresolved operation '<' for 'Ecore::ecore::EInt' [message #666393] Wed, 20 April 2011 09:53 Go to next message
Joern is currently offline Joern
Messages: 22
Registered: March 2010
Junior Member
Hi,

I get the error "Unresolved operation '<' for 'Ecore::ecore::EInt'" trying to use the "sortedBy" operation.

My expression evaluates using the old Interactive OCL console but not the new Interactive Xtext OCL console or the generated model validation.

A sample metamodel looks like this:

module _'test.ecore'
import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';

package test : test = 'http://test/test' 
{
	class Test
	{
		attribute ordinal : ecore::EInt[?] { ordered };
		operation test() : Test[*]
		{
			body: (Test.allInstances())->sortedBy(ordinal);
		}
	}
}

Any help is appreciated.

Best regards,

Joern
Re: Unresolved operation '<' for 'Ecore::ecore::EInt' [message #666408 is a reply to message #666393] Wed, 20 April 2011 11:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4061
Registered: July 2009
Senior Member
Hi Joern

Quick workaround. Use Integer (or ecore::EBigInteger),
ecore::EIntegerObject instead of ecore::EInt for the declaration or
ordinal.oclAsType(Integer) in the iterator body.

The '<' operation is automatically synthesized when the instance class
name implements Comparable. Looks like it needs a bit more intelligence
for built-in types. Will fix.

Regards

Ed Willink

On 20/04/2011 10:53, Joern wrote:
> Hi,
>
> I get the error "Unresolved operation '<' for 'Ecore::ecore::EInt'"
> trying to use the "sortedBy" operation.
> My expression evaluates using the old Interactive OCL console but not
> the new Interactive Xtext OCL console or the generated model validation.
>
> A sample metamodel looks like this:
>
> module _'test.ecore'
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package test : test = 'http://test/test' {
> class Test
> {
> attribute ordinal : ecore::EInt[?] { ordered };
> operation test() : Test[*]
> {
> body: (Test.allInstances())->sortedBy(ordinal);
> }
> }
> }
> Any help is appreciated.
>
> Best regards,
>
> Joern
Re: Unresolved operation '<' for 'Ecore::ecore::EInt' [message #666430 is a reply to message #666393] Wed, 20 April 2011 13:06 Go to previous message
Joern is currently offline Joern
Messages: 22
Registered: March 2010
Junior Member
Hi Ed,

Thanks, that helped Smile

Best regards,

Joern
Previous Topic:Unresolved operation '<' for 'Ecore::ecore::EInt' (double entry: no text)
Next Topic:Parsing expressions without context
Goto Forum:
  


Current Time: Thu Oct 02 16:37:32 GMT 2014

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

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