Flow diagrams to Petri nets

This document describes how the FD2PN component has been reused for several workflow languages. This component features a reusable transformation from a Workflow concept to a Petri net, which is able to deal with several of the patterns defined in the Workflow patterns catalog.

The menu provides links to the different artefacts of the case study.

Code for Bentō:
Template:
Concepts:
Meta-models:

Business Process Model and Notation (BPMN) by Intalio

Intalio BPMS is an open-source solution to implement Business Process Management Systems (BPMS). It provides its own implementation of the Business Process Model and Notation (BPMN), which is a graphical representation for specifying business processes in a business process model. A process model in Intalio-BPMN is a flow of activities which can be of different type, like Task, different kinds of Event and different kinds of Gateway. Events indicate where a particular process starts or ends. Gateways model a divergence or convergence of the workflow, like the execution of only one outgoing branch (exclusive), several outgoing branches (inclusive) or all of them (parallel).

Meta-model

The following diagram is an excerpt with the relevant elements of the Intalio-BPMN meta-model.

Binding

All flow nodes in Intalio are represented by the same class Activity, which has the attribute activityType (an enumerate) to indicate the particular kind of activity. Thus, the binding maps each subtype of Node in the concept to the class Activity in the meta-model, using a filter (when) to select only the activities of the appropriate type in each case. For instance, Task in the concept is mapped to the activities with value #Task or #EventStartEmpty in its attribute activityType. In the case of gateways, in addition to the value of the attribute activityType, the filter takes into account the number of input/output flow edges: either one input and several outputs (ParallelGateway, Synchronization, SimpleMerge) or several inputs and one output (MultiChoice). FlowEdge in the concept is easily mapped to SequenceEdge in the meta-model, being both classes. The binding of their relations are simple renamings as well.

binding bpmn2fd {  
	concept   FD   : "platform:/resource/bento.examples.flow_diagrams.petrinets/metamodels/flow_concept.ecore"
	metamodel BPMN : "platform:/resource/bento.examples.flow_diagrams.petrinets/bindings/intalio2pn/bpmn.ecore"

	class FlowDiagram to BpmnDiagram	
	class Node        to Vertex
	class FlowEdge    to SequenceEdge
	
	class Task            to Activity when self.activityType = #Task or
	                                       self.activityType = #EventStartEmpty   
	     						           
	class FinalTask       to Activity when self.activityType = #EventEndEmpty or 
                                               self.activityType = #EventEndTerminate

	class ExclusiveChoice to Activity when self.activityType = #GatewayDataBasedExclusive or 
	                                       self.activityType = #GatewayEventBasedExclusive
	                                        
	class ParallelSplit   to Activity when self.activityType = #GatewayParallel and
	                                       self.incomingEdges.size() = 1 and 
	                                       self.outgoingEdges.size() > 1

	class Synchronization to Activity when self.activityType = #GatewayParallel and
	                                       self.outgoingEdges.size() = 1 and
	                                       self.incomingEdges.size() > 1

	class MultiChoice     to Activity when self.activityType = #GatewayDataBasedInclusive and
	                                       self.outgoingEdges.size() > 1 and
	                                       self.incomingEdges.size() = 1

	class SimpleMerge     to Activity when self.activityType = #GatewayDataBasedInclusive and
	                                       self.outgoingEdges.size() = 1 and
	                                       self.incomingEdges.size() > 1
	
	feature FlowDiagram.nodes = self.pools->collect(p | p.vertices).flatten()
	feature FlowDiagram.edges = self.pools->collect(p | p.sequenceEdges).flatten()

	feature FlowEdge."in" is source
	feature FlowEdge.out is target

	feature Node."ins" is incomingEdges
	feature Node.outs is outgoingEdges

	feature Task.isInitial = self.activityType = #EventStartEmpty
	feature Task.name is name
	
	feature FinalTask.isTerminating = false
}