Displaying items by tag: validation

Wednesday, 09 December 2020 07:31

How to Validate your Enterprise Architect BPMN Models

How to Validate your Enterprise Architect BPMN Models

The BPMN notation is a good way to specify processes, may it be the workflow for a specific task or entire business processes. Such models may grow very large and you can easily lose track of certain details such as model correctness. 

Figure 1 shows an example for a BPMN model (using the BPMN 2.0 MDG Technology), a process for resolving problems which are reported via a ticket system.

 

BPMN Example
Fig 1: BPMN Process example modelled with the Enterprise Architect (example source: OMG).

 

Do you see the Error?

Maybe you’ve noticed that the final node of the model does not have any incoming control flow edges but instead has an outgoing control flow edge.

Also the Activity ‘Insert issue into product backlog’ is not reachable, because it has no incoming edge. This leads us to the problem that the Enterprise Architect may (only) ensure that every BPMN model is syntactically valid: it prohibits modelling actions which would result in syntactically invalid BPMN models, e.g. a control flow to an element that does not belong to activities, like an Interface.

What the Enterprise Architect does not ensure is semantic correctness.

 

Formal Validation with OCL

A formal way to validate semantic restrictions on (BPMN) models is to use the Object Constraint Language (OCL) to define constraints the models must fulfill in order to be correct.

In our case we could define the following constraint to ensure that a final node does not have any outgoing control flow edge:

 

context a:Activity inv:

a.nodes -> forAll(node | not(node.oclIsTypeOf(FlowFinalNode)) or node.outgoing -> isEmpty())

 

But then an unconnected final node would still be valid and we also do not cover the unreachable activity. With another constraint we can ensure that every node in the model (except for initial nodes) has an incoming edge:

 

context a:Activity inv:

a.nodes -> forAll(node | node.oclIsTypeOf(InitialNode) or not(node.incoming -> isEmpty()))

 

Unfortunately, the Enterprise Architect has no feature yet to evaluate any formal constraints like OCL.

To evaluate the constraints on our model we use other tools to load our Enterprise Architect models and run OCL constraints on it.

 

Semantic Validation of BPMN Models in Eclipse

To show what is possible, we use the YAKINDU EA-Bridge to load our models and evaluate them with the OCL Console.

Once the Enterprise Architect model is loaded with the YAKINDU EA-Bridge, it can be browsed in a simple tree-based editor (as seen in Figure 2), element details are shown in the ‘Properties’ view.

 

EA Model in Eclipse
Fig 2: Our Enterprise Architect model loaded with the YAKINDU EA-Bridge in Eclipse

 

Now we want to select the activity ‘BPMN 2.0 Business Process View’ and open the OCL Console (open the ‘Console’ View in Eclipse and select the ‘OCL Console’ in the drop-down toolbar icon of the view).

There we can enter our constraints and observe the evaluation result (Figure 3).

Please note that the plain constraint must be entered, the context of our invariants above is the currently selected element in the editor!

OCL Console
Fig 3: The OCL Console in Eclipse

 

Once we have run our evaluation and got the result that the model violates the constraints, we can fix our BPMN model and run the OCL evaluation on the corrected model (see Figure 4) again.

 

BPMN Example Correct

Fig 4: Semantically valid Model, because the Final Node has no outgoing control flow but instead has an incoming control flow.
 Also the Activity ‘Insert issue into product backlog’ has an incoming control flow and is therefore reachable.

 

This time our constraints evaluate to ‘true’:

 

Positive OCL Console

 

To conclude, the usage of additional tools like the YAKINDU EA-Bridge and an OCL Interpreter enables further use cases like validation of BPMN Models by a predefined set of OCL constraints.

There are already projects working on such predefined sets of OCL constraints for BPMN models, for example, ‘OPEN-BPMN-OCL’. The next step would then be to implement automatic model validation.

 

Try it yourself

 

Do you want to try it out yourself? 

First download the YAKINDU EA-Bridge Trial Eclipse Distribution, which is free to download. Unpack and start it, select a workspace location, and go to ‘Help’ -> ‘Install New Software’. The following dialog should appear. Copy ‘https://download.eclipse.org/modeling/mdt/ocl/updates/releases/latest’ into the field ‘Work with’.

You should now be able to select the ‘OCL’, ‘OCL build’, and ‘OCL tests’ items:

Install OCL

Click ‘Next >’ and finish the installation. Once it is finished, restart Eclipse to complete the installation.


The next thing to do is creating a new 'General Project', this can be done via the ‘File’ Menu:

New Project

After creating the project, please download the attached zip file, which contains the BPMN example and an XML file (which defines a slightly adapted version of the BPMN 2.0 MDG Technology). Copy these two files into the newly created project. Finally, change the preferences for the YAKINDU EA-Bridges to look for EA profiles in the same folder (in Eclipse: 'Window' -> 'Preferences' -> 'YAKINDU EA-Bridge' -> 'UML' -> 'Profile Locations').

YEB preferences 

Once this is done you can start experimenting with the example as shown in the screenshot above.

 

Published in Tutorials

LieberLieber is proud to announce a new and free Enterprise Architect plug-in called EnArValidationRules essential for all Enterprise Architect users who want to validate their models with individual and customizable validation rules. In addition, it provides the possibility to auto-correct any errors and warnings that occur, based on the pre-defined validation rules.

Key features:

  • Validate your models and diagrams
  • Enable/Disable each validation rule
  • Activate auto-correction for each rule
  • Backup your models automatically

As depicted in the screenshot, we have defined different rules for demonstration purposes. For example, the total account of elements for each package or diagram is limited to a certain number. Furthermore, it is only allowed to use instances of classes within a sequence diagram. And each element has to realize at least one requirement or test case. Of course, these rules can be adopted and extended.

You can download this free plug-in here.

If you are interested in more rules for your modeling projects, do not hesitate to contact sales(at)lieberlieber(dot)com.

Published in News