# TransformingBPMN Processes toSBVR Process Rules with
## 3 Transformation of BPMN Processes to SBVR Process Rules
### Extracting Process Rules from Multiple Cascading Gateways  
Other than the defined process patterns, our approach also supports the so-called cascading gateways, that is, when a sequence flow leaves one diverging/converging gateway and leads directly to another diverging/converging gateway forming a cascade of two sub-sequentially diverging gateways. The processing of cascading gateways follows the so-called backward-chaining principle analyzing the required number of flow objects retrospectively and combining multiple conditions of the diverging and converging sequence flows into one process rule. The processing of such chains can be challenging at both the conceptual and engineering levels. To present the developed algorithm, let us first introduce the notions of _activity node neighborhood_ (Definition 1). **Definition 1**. : _Activity node neighborhood is defined as a tuple_  
\[A_{N}=\left\langle act,\ S_{act},\ SF_{inc},\ SF_{out},\ SF_{inc}^{D},SF_{out}^{D}\right\rangle\]  
_where:_  
* _activity is an activity node: (type(activity)_\(\in\) _[Task, Event, SubProcess];_
* \(S_{act}\) _is a set of subjects performing the defined activity;_
* \(SF_{inc}\) _is a set of sequence flows incoming to the activity act, with or without conditions;_
* \(SF_{out}\) _is a set of sequence flows outgoing from the activity, with or without conditions;_
* \(SF_{inc}^{D}\) _is a set of default sequence flows incoming to the activity;_\(SF_{out}^{D}\) is a set of default sequence flows outgoing from the activity._  
Given such a formal structure, one can apply it to process the defined rules \(T_{2}\), \(T_{3}\), \(T_{4}\), and \(T_{5}\). To process a chain of gateways, one must also consider advanced structures supporting recursive gateway processing. Therefore, a _gateway neighborhood_ definition must be introduced (Definition 2). **Definition 2**. : _Gateway neighborhood is defined as a tuple_  
\(G_{N}=\left\langle\textit{gate, type, }S_{activity}\text{, }\mathcal{A}_{Ninc}\text{, } \mathcal{A}_{Nout}\text{,, }\mathcal{G}_{Ninc}\text{, }\mathcal{G}_{Nout}\text{, }\mathcal{S}_{inc}\text{, } \mathcal{F}_{inc}\text{, }SF_{out}\text{, }SF_{inc}^{D}\text{, }SF_{out}^{D}\text{, }R_{ part}\right\rangle\)__  
_where:_  
* _gate is a BPMN gateway node;_
* _type is a type of the defined gateway gate (type_\(\in\) _[inclusive, exclusive, event-based, parallel]);_
* \(\mathcal{A}_{Ninc}\) _is a set of activities incoming to the gateway gate;_
* \(\mathcal{A}_{Nout}\) _is a set of activities outgoing from the gateway gate;_
* \(\mathcal{G}_{Ninc}\) _is a set of other gateways incoming to the gateway gate;_
* \(\mathcal{G}_{Nout}\) _is a set of other gateways outgoing from the gateway gate;_
* \(SF_{inc}\) _is a set of incoming to the gateway gate, with or without conditions;_
* \(SF_{out}\) _is a set of outgoing from the gateway gate, with or without conditions;_
* \(SF_{inc}^{D}\) _is a set of default sequence flows incoming to the gateway gate;_
* \(SF_{out}^{D}\) _is a set of default sequence flows outgoing from the gateway gate;_
* \(R_{part}\) _is a partial rule, recursively extracted at the gateway gate._  
Gateway neighborhoods are constructed recursively and exclusively from incoming or outgoing sequence flows, which have gateways at their ends. For our backward-chaining algorithm, we will use only \(\mathcal{G}_{Ninc}\) ; then, gateway element \(el\) is extracted as follows:  
\(\mathcal{G}_{Ninc}^{el}=\mathcal{G}_{Ninc}^{el}\cup G_{N}(g)\), \(\forall g\in\{source(SF_{inc})|\ source(SF_{inc})\text{ is gateway and target}(SF_{inc}=el)\}\)  
where \(SF_{inc}\) is a set of BPMN sequence flows incoming to \(el\). Further, we present an algorithm (Algorithm 1), which is used to extract process rules from tuples of sub-sequentially interconnected gateways.