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

UML2.0 Activity Diagramas

The UML is an OMG's specification for modelling of software applications from different perspectives, for which it provides different types of diagrams. Among them, activity diagrams specify the coordination of executions of subordinate behaviours, using a control and data flow model. An activity can be initiated when other diagram finishes its execution, when objects and data become available, or when events occur external to the flow. The flow of execution is modeled as activity nodes connected by activity edges. Activity nodes also include flow-of-control constructs, like synchronization of concurrent executions (forks and joins), decision and concurrency control. There are also initial and final nodes for starting and ending flows. There are two types of final nodes: activity final nodes and flow final nodes. An activity final node is a final node that stops all flows in an activity diagram. There may be several activity nodes, and the first one reached stops all flows in the activity. On the other hand, flow final nodes model the end of a flow, but reaching a node of this type does not stop the rest of flows in the activity.


The following diagram is an excerpt with the relevant elements of the Activity Diagram meta-model.


The meta-model of activity diagrams defines ActivityNode as superclass for all types of flow nodes, and represents flow edges using the class ActivityEdge; therefore, they are mapped to Node and FlowEdge in the concept, respectively. Task is bound to three classes in the meta-model: ObjectNode, ExecutableNode and InitialNode. Only the last one can be used to represent the starting point of an activity, hence the binding assigns the value true to its feature isInitial, while it assigns the value false to the same feature in the other two classes. The meta-model contains a class for each type of gateway in the concept, excluding MultiChoice, whose semantics is not supported by activity diagrams, and therefore it is mapped to NONE. FinalNode in the meta-model is mapped to FinalTask in the concept. Regarding the feature isTerminating, it is true when the concrete type of final node is ActivityFinalNode (i.e. flow final nodes do not terminate the flow of the activity).

binding ad2fd {  
	concept   FD   : "platform:/resource/bento.examples.flow_diagrams.petrinets/metamodels/flow_concept.ecore"
	metamodel UML  : "platform:/resource/bento.examples.flow_diagrams.petrinets/bindings/ad2pn/UML.ecore"

	class FlowDiagram to Activity		
	class Node        to ActivityNode 	
	class FlowEdge    to ActivityEdge 
	class Task to ObjectNode, ExecutableNode, InitialNode
	feature Task[ExecutableNode].name is name
	feature Task[ExecutableNode].isInitial = false
	feature Task[ObjectNode].name is name
	feature Task[ObjectNode].isInitial = false
	feature Task[InitialNode].name = 'Initial'
	feature Task[InitialNode].isInitial = true 
	class ExclusiveChoice to DecisionNode	                                        
	class ParallelSplit   to ForkNode
	class Synchronization to JoinNode 
	class MultiChoice     to NONE
	class SimpleMerge     to MergeNode
	feature FlowDiagram.nodes is node
	feature FlowDiagram.edges is edge

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

	feature Node."ins" is incoming
	feature Node.outs  is outgoing

	class FinalTask to FinalNode
	feature FinalTask.isTerminating = self.oclIsKindOf(UML!ActivityFinalNode)