Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Pivot validation bug
OCL Pivot validation bug [message #1123370] Wed, 02 October 2013 13:46 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
let say i have an attribute of type double and its derivation OCL statement return "true" then it should be a validation error but for me validation is successful. I have attached ecore file.

Ecore file contains one class having one attribute of double type and its derivation statement is "true". For me validation is successful.

I have also tried to validate progeramatically and there is no validation error.

Code :
org.eclipse.ocl.examples.pivot.OCL ocl = org.eclipse.ocl.examples.pivot.OCL.newInstance(new PivotEnvironmentFactory());
org.eclipse.ocl.examples.pivot.helper.OCLHelper helper = ocl.createOCLHelper();

helper.setPropertyContext(eClass, eAttribute);
try {
org.eclipse.ocl.examples.pivot.ExpressionInOCL exp = helper.createDerivedValueExpression(body);


} catch (org.eclipse.ocl.examples.pivot.ParserException e) {
message = e.getDiagnostic().getMessage();
}
Re: OCL Pivot validation bug [message #1123371 is a reply to message #1123370] Wed, 02 October 2013 13:49 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
here comes the screen shot to show validation is successful
index.php/fa/16358/0/
Re: OCL Pivot validation bug [message #1123696 is a reply to message #1123370] Wed, 02 October 2013 20:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

If I load your example into the 4.2M2 OCLinEcore editor and Validate I get:

'Property::CompatibleDefaultExpression' constraint is not satisfied
for 'temp::Tester.total'

so the validation is there; unfortunately the report is against line 1
rather than line 9. https://bugs.eclipse.org/bugs/show_bug.cgi?id=418552
raised.

I'm not aware of any hook in the Sample Ecore Editor that OCL can attach
to to add the functionality within the Sample Ecore Editor. The closest
approximation is the ResourceSet poke by the "Load Complete OCL
Resource..." menu action. Maybe there could be an "Enable OCL
validation" menu action.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=418551 raised.

Regards

Ed Willink

On 02/10/2013 09:46, ModelGeek Mising name wrote:
> let say i have an attribute of type double and its derivation OCL statement return "true" then it should be a validation error but for me validation is successful. I have attached ecore file.
>
> Ecore file contains one class having one attribute of double type and its derivation statement is "true". For me validation is successful.
>
> I have also tried to validate progeramatically and there is no validation error.
>
> Code :
> org.eclipse.ocl.examples.pivot.OCL ocl = org.eclipse.ocl.examples.pivot.OCL.newInstance(new PivotEnvironmentFactory());
> org.eclipse.ocl.examples.pivot.helper.OCLHelper helper = ocl.createOCLHelper();
>
> helper.setPropertyContext(eClass, eAttribute);
> try {
> org.eclipse.ocl.examples.pivot.ExpressionInOCL exp = helper.createDerivedValueExpression(body);
>
>
> } catch (org.eclipse.ocl.examples.pivot.ParserException e) {
> message = e.getDiagnostic().getMessage();
> }
Re: OCL Pivot validation bug [message #1124161 is a reply to message #1123696] Thu, 03 October 2013 08:42 Go to previous message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

As i have preceived from your reply validation does work it is just that the sample ecore editor does not contain a proper link to OCL validation.
But i have tried to write the following code to validate the same OCL. I am trying to create derived value expression for the property context. I should get the ParserException but i am not getting ParserException.... do you have any clue why it is..? if i have other syntax errors (like spelling mistake or invalid property or operation name) then i am getting the ParserException and the following code works fine... why just this specific scenario does not work?

org.eclipse.ocl.examples.pivot.OCL ocl = org.eclipse.ocl.examples.pivot.OCL.newInstance(new PivotEnvironmentFactory());
org.eclipse.ocl.examples.pivot.helper.OCLHelper helper = ocl.createOCLHelper();

helper.setPropertyContext(eClass, eAttribute);
try {
org.eclipse.ocl.examples.pivot.ExpressionInOCL exp = helper.createDerivedValueExpression(body);


} catch (org.eclipse.ocl.examples.pivot.ParserException e) {
message = e.getDiagnostic().getMessage();
}

thanks!
Previous Topic:[Announce] Eclipse OCL 4.1.1 (Kepler SR1) is now available
Next Topic:Forum Netiquette
Goto Forum:
  


Current Time: Sat Apr 27 04:23:02 GMT 2024

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

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

Back to the top