Book a Demo

Author Topic: OCL Validation Warning  (Read 5496 times)

Carl

  • EA User
  • **
  • Posts: 24
  • Karma: +1/-0
    • View Profile
OCL Validation Warning
« 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

Frank Crow

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: OCL Validation Warning
« Reply #1 on: April 15, 2014, 09:31:33 am »
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

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: OCL Validation Warning
« Reply #2 on: April 15, 2014, 10:34:09 am »
Try restarting EA and then run the OCL validation again.  Does the same error still get reported?

Frank Crow

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: OCL Validation Warning
« Reply #3 on: April 15, 2014, 11:14:57 am »
Restarted EA and still get the same thing.

thanks,
Frank

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: OCL Validation Warning
« Reply #4 on: April 15, 2014, 07:04:49 pm »
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.

Carl

  • EA User
  • **
  • Posts: 24
  • Karma: +1/-0
    • View Profile
Re: OCL Validation Warning
« Reply #5 on: April 15, 2014, 11:19:16 pm »
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.

Frank Crow

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: OCL Validation Warning
« Reply #6 on: April 16, 2014, 12:25:21 pm »
Same here!

Thanks,
Frank

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: OCL Validation Warning
« Reply #7 on: April 16, 2014, 07:05:18 pm »
So you should probably send a bug report (bottom right of the page).

q.