Archive for January, 2007

OCL support in Enterprise Architect

Monday, January 15th, 2007

Hello,

recently I  looked at Enterprise Architects support for OCL.
Enterprise Architect (EA) is a UML modeling tool from Sparx Systems.
EA offers the capability to define OCL expressions in the model which are verified by EA on user request. These constraints are evaluated if the user explicitly starts a 'model validation' by selecting the according menu entry. EA has a couple of built in checks also but I'd like to focus on the user defined OCL checks now.

OCL constraints can be attached to relationships or attributes. This implicitly defines the context of the expression. One thing to note is that the expressions are applied to the UML metamodel and not to the model itself in the traditional sense. This becomes pretty obvious when looking at the examples given in the help file:

inv: self.oclIsKindOf(DirectedRelationship) 

This is necessary if OCL is used to verify the model itself but this is a somewhat unusual purpose of using OCL. The main purpose of OCL is to add precision to a model and formally document information that cannot (appropriately) be expressed with diagrams. The usage of OCL for model checking is a valuable but different usage and I think that Sparx Systems should communicate better that OCL is used for model checking in their tool and not to enrich the model itself.

Another flaw of this approach is that it does not make sense to define an OCL expression that refers to the metamodel at a property in the actual model. The reason is that each and every attribute is modeled as a similar metamodel element and this is defined by EA itself, there is nothing the user of EA can do about it. In other words, an attribute is either always a kind of directed relationship or never but this cannot be defined by the user of the tool and in particular it cannot be defined on a per attribute basis.

Now as I have understood how EA utilizes OCL expressions I wanted to get a feeling for the quality of EAs OCL parser. I created a new class and added an attribute of type String. I then added this constraint (of type "OCL" – EA supports various types of constraints):

inv: size() > 0

This is a valid OCL expression if interpreted at the model level. Now since EA claims to evaluate OCL expressions at the metamodel level, the expression should be invalid because the context object (which should be 'class Attribute' and is implicitly defined by EA) does not have a method 'size()'. After clicking 'OK' in the dialog EA does not display an error message as I would have expected.

Next I tried an obviously invalid expression, which should result in a type mismatch error:

inv: 1 < 'a'

But again I got no error message although the manual says:

"It is important to note that in order to have a valid OCL constraint EA requires that the syntax be correctly formed, if the expression is not correct EA will inform the user that the OCL constraint is not valid."

Hoping that at least during model validation the incorrect OCL expression would be reported I started the model validation. The result was "Validation complete – 0 error(s), 0 warning(s)".

I could not believe that the OCL support was so much broken and searched the EA forums for OCL. I quickly found a couple of postings that confirmed that the OCL support in EA is indeed as bad as it seemed to me, for example in this post (btw., the original poster of this thread did not realize that OCL is used for the purpose of model validation and not in the usual sense).

Now, don't get me wrong, I think that Enterprise Architect is a great software and offers an outstanding price/value ratio. I would heartily recommend it for any modeling project and I have made only the best experiences with their support (yes, we use EA internally). It just seems as if OCL has a very low priority on their internal feature list which probably reflects the customer interest.

As always, comments and feedback are welcome. In particular, if you are interested in a version of Oclarity for Enterprise Architect please let us know.

Best regards,
Andreas

 

 

Oclarity 1.8.3 released

Tuesday, January 2nd, 2007

Hello all,

before Christmas we have released version 1.8.3 of Oclarity, our OCL AddIn for Rational Rose. This release is a bug fix release based on customer feedback.

The new features are:

  • Inconsistencies in the model are handled more gracefully
  • Package lookup is improved
  • Warnings have now some context information so that it is (much) easier to understand the root cause

For example, if an attribute of a class is of an unknown type, only a warning is emitted while older versions generated an error. Chances are that the affected attribute (for example) is not relevant for the OCL expression that is checked and in this case aborting the whole check with an error was not really helpful.

As always, we appreciate your comments. 

We hope you like the new version and wish you a happy and successful new year.

Andreas