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.
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();
> }
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?