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ō:

Business Process Model and Notation (BPMN) by OMG

The Business Process Model and Notation (BPMN) allows the graphical representation of business process models. In BPMN, a process model is made of a set of flow nodes of different types (activities, events and gateways) which can be interconnected through sequence flows. Activities are works performed within a business process, whereas a Task is an atomic activity within a process workflow. An event is somethig that happens during the course of a process, and may indicate where a particular process starts or ends. Gateways are used to control the process flow as they converge and diverge within a process, like the execution of only one outgoing branch (exclusive), several outgoing branches (inclusive) or all of them (parallel).


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


The classes FlowNode and SequenceFlow in the BPMN meta-model can be naturally mapped to Node and FlowEdge in the concept. This is so as BPMN defines the superclass FlowNode for all types of nodes and gateways, as our concept does, and also represents the sequence flow using a class. Task in the concept is mapped to the meta-model classes Task and StartEvent, while its feature isInitial is set to true in the case of start events, and set to false in tasks. FinalTask in the concept is represented in BPMN using the class EndEvent. Both gateways ParallelSplit and Synchronization in the concept are mapped to ParallelGateway in BPMN, in the first case when the gateway has one input and several outputs, and in the second case when it has several outputs and one input. Similarly, gateways SimpleMerge and MultiChoice in the concept are both mapped to class InclusiveGateway in the meta-model, in the first case when the gateway has several inputs and one output, and in the second case when it has one input and several outputs. Finally, ExclusiveChoice is mapped to two BPMN classes: EventBasedGateway (but only in the case the value of its attribute eventGatewayType is #exclusive), and ExclusiveGateway. To define this dual binding, ExclusiveChoice is bound to a class Gateway in the meta-model, which is a superclass of both EventBasedGateway and ExclusiveGateway; then, a filter selects only those having the appropriate type and attribute values.

binding bpmn_omg2fd {  
	concept   FD   : "platform:/resource/genericity.benchmarks/components/flowdiagrams/metamodels/flow_concept.ecore"
	metamodel BPMN : "platform:/resource/genericity.benchmarks/components/flowdiagrams/bpmn2pn/bpmn.ecore"

	class FlowDiagram	to Process
	class Node 		to FlowNode
	class FlowEdge 		to SequenceFlow
	class Task		to Task, StartEvent
	class FinalTask		to EndEvent
	class ExclusiveChoice 	to Gateway when if self.oclIsTypeOf(BPMN!EventBasedGateway)  
						then self.eventGatewayType = #exclusive
						else self.oclIsTypeOf(BPMN!ExclusiveGateway) endif
	class ParallelSplit   	to ParallelGateway  when self.incoming.size() = 1 and self.outgoing.size() > 1
	class Synchronization 	to ParallelGateway  when self.incoming.size() > 1 and self.outgoing.size() = 1
	class SimpleMerge   	to InclusiveGateway when self.incoming.size() > 1 and self.outgoing.size() = 1   
	class MultiChoice	to InclusiveGateway when self.incoming.size() = 1 and self.outgoing.size() > 1	
	feature FlowDiagram.nodes = self.flowElements->select(f | f.oclIsKindOf(BPMN!FlowNode) )
	feature FlowDiagram.edges = self.flowElements->select(f | f.oclIsKindOf(BPMN!SequenceFlow) )
	feature Task[Task].isInitial = false
	feature Task[Task].name is name

	feature Task[StartEvent].isInitial = true
	feature Task[StartEvent].name is name
	feature Node.outs is outgoing
	feature Node.ins  is incoming
	feature FlowEdge."in" is sourceRef
	feature FlowEdge.out  is targetRef
	feature FinalTask.isTerminating = false