Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » UMLPrimitiveType int x OCL UnlimitedNatural
UMLPrimitiveType int x OCL UnlimitedNatural [message #994572] Thu, 27 December 2012 18:09 Go to next message
John Guerson is currently offline John Guerson
Messages: 51
Registered: August 2011
Member
Hi,

A UML PrimitiveType int is different from OCL Literals Integer and UnlimitedNatural?

In the following constraint:

context Person inv : self.age > 0


age result in a PrimitiveType "int".
0 is a UnlimitedNatualExp in OCL.

The Complete OCL Editor does not shows any erros ... but when i run the method parse() i got the error above:

org.eclipse.ocl.SemanticException: Cannot find operation (>=(Integer)) for the type (int)
	at org.eclipse.ocl.util.OCLUtil.checkForErrors(OCLUtil.java:358)
	at org.eclipse.ocl.OCL.parse(OCL.java:323)
	at br.ufes.inf.nemo.ocl2alloy.parser.OCLParser.<init>(OCLParser.java:152)
	at br.ufes.inf.nemo.ocl2alloy.parser.OCLParser.main(OCLParser.java:197)


But if i do the cast oclAsType(Integer) the method parse() executes succesfully:

context Person inv : self.age.oclAsType(Integer) > 0
context Person inv : self.age.oclAsType(UnlimitedNatural) > 0


Any Idea on how to solve this?

Appreciate your attention...
John


Re: UMLPrimitiveType int x OCL UnlimitedNatural [message #994579 is a reply to message #994572] Thu, 27 December 2012 18:32 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

I think this was fixed in the Kepler M3 milestone, so you could use the
latest M4 milestone, which should be installable on Juno.

Or just use oclAsType() as you discovered.

(The bug is was in the legacy Ecore-based OCL parser of EDataType
argument operations. The Complete OCL editor uses the
new pivot-based parser which has no error here.)

You could also change the delegate URI in the OCL Preference Page so
that the Pivot-based evaluator is used.

Regards

Ed Willink


On 27/12/2012 18:09, John G. wrote:
> Hi,
>
> A UML PrimitiveType int is different from OCL Literals Integer and
> UnlimitedNatural?
>
> In the following constraint:
>
>
> context Person inv : self.age > 0
>
>
> age result in a PrimitiveType "int".
> 0 is a UnlimitedNatualExp in OCL.
>
> The Complete OCL Editor does not shows any erros ... but when i run
> the method parse() i got the error above:
>
>
> org.eclipse.ocl.SemanticException: Cannot find operation (>=(Integer))
> for the type (int)
> at org.eclipse.ocl.util.OCLUtil.checkForErrors(OCLUtil.java:358)
> at org.eclipse.ocl.OCL.parse(OCL.java:323)
> at
> br.ufes.inf.nemo.ocl2alloy.parser.OCLParser.<init>(OCLParser.java:152)
> at
> br.ufes.inf.nemo.ocl2alloy.parser.OCLParser.main(OCLParser.java:197)
>
>
> But if i do the cast oclAsType(Integer) the method parse() executes
> succesfully:
>
>
> context Person inv : self.age.oclAsType(Integer) > 0
> context Person inv : self.age.oclAsType(UnlimitedNatural) > 0
>
>
> Any Idea on how to solve this?
>
> Appreciate your attention...
> John
>
>
>
Previous Topic:OCL and QVT
Next Topic:UI Dependency Problem of emf.Diagnostics (instance models with OCL Pivot constraints)
Goto Forum:
  


Current Time: Tue Sep 23 16:36:19 GMT 2014

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

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