Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Carl on April 15, 2014, 12:00:14 am
-
Hi,
I have an OCL constraint defined as follows on a class. When I save the constraint, I get the message "OCL Validation Successful".
inv: rating >= 0
Where rating is an int attribute of the class BlogEntry.
However, when I validate a diagram containing the class and run Model > Validate Selected, I get the following warning.
MVR040001 - warning (BlogEntry (Class)): OCL violation: inv: rating >= 0
Does anyone know if this is a bug? I've also experimented with "self" (which isn't required) and gotten the same results.
Thanks
-
What a coincidence! I just finished reading the book on OCL and was trying to implement some constraints. I get the same exact thing. When I save the constraint, if it is legitimate OCL syntax it does say "OCL validation successful" and if I violate the syntax, I get an error message. But then when I do Project->Validate Selected... I get the same as thing you are getting. A *warning* that says "OCL violation" (MVR040001) which the EA help says "The element violates the OCL constraint specified." I am using a very simple constraint, I'm not even sure how EA thinks that the expression is true/false either way. It is not like I'm giving it any values for the attributes!
Very confusing! Any help is highly appreciated!
Thanks,
Frank
-
Try restarting EA and then run the OCL validation again. Does the same error still get reported?
-
Restarted EA and still get the same thing.
thanks,
Frank
-
From what I remember EA never executed any OCL but only validated the OCL syntax. That might have changed over the last versions, though.
q.
-
The OCL syntax looks fine to me. I have an "inv:" leading off the expression. I've tried "rating >= 0" and "self.rating >= 0". Moreover, I get the "successful" message when I save the expression in the Properties Dialog.
It's the Model Validation function that I'm asking about.
-
Same here!
Thanks,
Frank
-
So you should probably send a bug report (bottom right of the page).
q.