1
General Board / Some tests for OCL usage
« on: February 05, 2008, 12:52:12 am »
Hi!
There are some issues to OCL in EA which I do not understand properly. I did some tests and came to the conclusion that OCL is not properly implemented, yet. However, I would be very interested in an announcement to what extend and when new OCL features will be implemented in EA. Here is a list of tests I did:
Consider a class having an attribute minNumber of type int which has an initial value of 6. I added an OCL constraint like this to this class: "inv minNumber: self.someNumber >= 6". I hit save and EA says "OCL validation successful", which sounds cool, but seems to refer only to the correctness of the OCL syntax. If I do a model validation (only "Element: OCL Conformance" is enabled) EA says: "Validation complete - 0 error(s), 0 warning(s)". Perfect! If I change the initial value of the attribute to a value lower than 6, the model validation fails - as expected. Perfect!
However, if I change the OCL expression to "inv minNumber: self->someNumber >= 6" (please note the "->" instead of the "." after "self), EA still says "OCL validation successful", although this is not valid OCL - to my understanding. Is my understanding correct? If yes, when will the OCL syntax check be updated in EA?
Next issue: Consider the classes "LoyalityProgram" and "ProgramPartner" (not the standard example). There is an aggregation from ProgramPartner to LoyalityProgram of multiplicity 1:1, which has the role name "partners" on the ProgramPartner's side. Further, there is an attribute "value" of type int and initial value 1 in ProgramPartner.
Now I add a constraint to LoyalityProgram like this: inv valueCheck: self.partners.value = 1. The syntax is okay according to OMG's OCL specification, although "partners" is supposed to be a collection (the nit-picker's syntax should be "self.partners->collect(value) = 1"). However, for both versions EA does say "OCL validation successful", but the actual model validation fails.
I did not find any means to make EA-OCL navigate associations properly. Each time a rolename of an association joins the game, EA reports a "MVR040001 - warning...". There are two possible reasons for this: 1. My understanding of OCL is simply to "basic" so I am not able to use it properly. 2. EA-OCL is not able to navigate associations. If the latter is the case, I would love to know, when this is supposed to change.
Cheers,
Olav
There are some issues to OCL in EA which I do not understand properly. I did some tests and came to the conclusion that OCL is not properly implemented, yet. However, I would be very interested in an announcement to what extend and when new OCL features will be implemented in EA. Here is a list of tests I did:
Consider a class having an attribute minNumber of type int which has an initial value of 6. I added an OCL constraint like this to this class: "inv minNumber: self.someNumber >= 6". I hit save and EA says "OCL validation successful", which sounds cool, but seems to refer only to the correctness of the OCL syntax. If I do a model validation (only "Element: OCL Conformance" is enabled) EA says: "Validation complete - 0 error(s), 0 warning(s)". Perfect! If I change the initial value of the attribute to a value lower than 6, the model validation fails - as expected. Perfect!
However, if I change the OCL expression to "inv minNumber: self->someNumber >= 6" (please note the "->" instead of the "." after "self), EA still says "OCL validation successful", although this is not valid OCL - to my understanding. Is my understanding correct? If yes, when will the OCL syntax check be updated in EA?
Next issue: Consider the classes "LoyalityProgram" and "ProgramPartner" (not the standard example). There is an aggregation from ProgramPartner to LoyalityProgram of multiplicity 1:1, which has the role name "partners" on the ProgramPartner's side. Further, there is an attribute "value" of type int and initial value 1 in ProgramPartner.
Now I add a constraint to LoyalityProgram like this: inv valueCheck: self.partners.value = 1. The syntax is okay according to OMG's OCL specification, although "partners" is supposed to be a collection (the nit-picker's syntax should be "self.partners->collect(value) = 1"). However, for both versions EA does say "OCL validation successful", but the actual model validation fails.
I did not find any means to make EA-OCL navigate associations properly. Each time a rolename of an association joins the game, EA reports a "MVR040001 - warning...". There are two possible reasons for this: 1. My understanding of OCL is simply to "basic" so I am not able to use it properly. 2. EA-OCL is not able to navigate associations. If the latter is the case, I would love to know, when this is supposed to change.
Cheers,
Olav