BPMN 2.0 from Visio Premium 2010

I mentioned in a previous post I had created a tool that converts BPMN diagrams from Visio Premium 2010 to BPMN 2.0-compliant XML. It was an interesting project because Visio itself does not internally "understand" the structure of a BPMN model. Sure, it can test many of the rules in the BPMN spec, but that is by testing relationships between the shapes in the diagram. A BPMN structural element that has no shape - such as a process or a collaboration - has no associated Visio object to manipulate. At the same time, if a pool is replicated on multiple pages of a hierarchical model, Visio contains multiple pool objects that must be combined into a single participant element in the XML. So mapping Visio Premium to BPMN 2.0 XML is tricky... but it can be done.

A fundamental principle of BPMN2.0 should be that there is one and only one way to serialize a properly constructed model. Excluding (for the moment) imported components, a single multipage Visio file equates to one BPMN model. In the XML, that means it all sits underneath a single definitions root. So... here is a question for you... if you have a multipage Visio file, how many collaboration, participant, and process elements does it contain? Visio itself cannot tell you. But you can deduce it from the shape information, assuming the model follows certain conventions.

Most of the conventions relate to hierarchical modeling, in which a collapsed subprocess on one page of the model is expanded on a separate hyperlinked page. Visio Premium 2010 supports this via the Process/CreateNew menu pick on a selected subprocess shape. (There is also a Process/LinkToExisting function, but I haven't played with it yet.) The conventions I apply to Visio Premium are, by and large, the same as I apply to structure-aware BPMN tools like Process Modeler for Visio from itp commerce. Here they are:

  • A page that is the target of a Process/CreateNew hyperlink is, by definition, a child-level page. A page that is not a child-level page is, by definition, a top-level page.
  • Each top-level page in a model that contains a visible pool shape defines a collaboration element in the XML.
  • Each pool (visible or invisible) in a top-level page defines a participant in the collaboration. (Only one pool may be invisible, and it cannot be an empty - or "black box" - pool.)
  • Each non-empty pool on a top-level page defines a process element in the XML. A top-level page may depict any number of processes, but only one can have an invisible pool.
  • A child-level page can contain elements of at most one process.
  • A child-level page can contain any number of black box pools, but there must be a corresponding pool (i.e., with the same name) on the top-level page. In other words, additional participants cannot be introduced on a child-level page.
  • If the process elements on a child-level page are enclosed in a visible pool shape, the pool must have the same name as the corresponding process pool on the top-level page.
Lanes are especially tricky in Visio Premium 2010, because pools and lanes share a common shape in the stencil. That is unfortunate since they mean very different things in BPMN. Adding to the fun, the first instance of this shape on a page creates multiple Visio objects, including the CFF Container object (what BPMN calls the pool) and the Pool/Lane object (what BPMN calls the lane). When you add a second instance alongside, Visio automatically encloses them in a container shape. In that case, the CFF Container shape in the diagram refers to the enclosing container, and the Pool/Lane shapes become the lanes. As a result...
  • Although it is allowed by BPMN, Visio Premium does not let you draw lanes without an enclosing pool.
  • If you draw a pool with no lanes, Visio creates a default lane for the pool. The name you type in the pool header is actually the lane name in Visio; the pool name is some default like 'Title' and is hidden. If the pool is non-empty, I assign the pool and the lane the same name in the BPMN XML, which by convention is the name of the process. In the XML, the lane is placed inside a laneset.
  • If the pool is empty, the default lane is excluded from the XML. A black box pool has no lanes, by definition.
  • Lanes in a child level page generate another laneset in the associated subprocess. The lanes defined in that laneset are independent of the lanes in the parent-level page.
  • While BPMN 2.0 allows nested sublanes, i.e. child lanesets of a lane, those child lanes must be drawn on the same page as the parent. Visio does not support this.
Data objects and associations are also tricky. In BPMN 1.2, these were artifacts. Most often the data object is drawn with a non-directional association to a sequence flow. In BPMN 2.0, data objects were upgraded to first-class semantic elements representing process variables, with dataAssociations representing mappings between those variables and data inputs and outputs of activities and events.

Furthermore, in BPMN 2.0 a non-directional association to a sequence flow is considered a visual shortcut, standing for a directional association from the sequence flow's source node to the data object and another one from the data object to the sequence flow's target node. In any case, Visio Premium cannot create a locked connection between an association and a sequence flow - i.e. the lines may look connected but they are really not. The upshot is that associating a data object with a sequence flow - the most common representation of data flow - is not supported by Visio Premium (in an exportable way). However, explicit data flow using directional associations from source node to data object to target node - the "right" way in BPMN 2.0 - works properly in Visio. Even though that representation is unfamiliar to most modelers today, it is the only way to draw BPMN-exportable data flow in Visio Premium.

Figure 1. Top-level page

Figure 2. Child-level page - expansion of Sub1.

The two-page model above, which contains the elements of the BPMN 2.0 analytic class supported in the Visio Premium palette, is automatically mapped by my tool to schema-valid BPMN 2.0 XML. If you are interested, the .vsd and mapped .bpmn files are here.