Using EVL to check inter-model consistency

As EVL builds on EOL, it inherits the capability to access multiple models simultaneously. An interesting application of that is that it can be used to express inter-model constraints. For example, say you have a UML and a DB model and you need to check that for each non-abstract class in the UML model there is a table with the same name in the DB model. This can easily be captured with the following EVL constraint…

context UML!Class {

	constraint CorrespondingTableExists {

		guard : not self.abstract

		check : DB!Table.allInstances.
			exists(t| =

		message : 'Table ' + + 
			' not found in the DB model'

		fix {

			title : 'Create table ' +

			do {
				var t := new DB!Table; :=;



The constraint is expressed in the context of UML!Class which means that it will be evaluated for all instances of Class in the UML model. In its guard part, the constraint defines that it does not apply to abstract classes. The check part iterates through all the instances of Table in the DB model and tries to find one that has the same name with the class the constraint is currently being checked on (self). If the check part is not satisfied for some particular class, the message part of the constraint is evaluated to provide a meaningful message to the user (e.g. for a Customer class the message would read Table Customer not found in the DB model).

Finally, the constraint also defines a fix that attempts to resolve the inconsistency by creating a table with that name in the DB model. The fix part defines 2 sub-parts: the title (which would evaluate to Create table Customer) and the do part that actually resolves the inconsistency by creating a table. Here it is worth mentioning that one can define multiple alternative fixes for a constraint which the user can select (or not) to execute if the constraint fails.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s