Translating BPMN to Business Rules

. Business Process Model and Notation (BPMN) is a standard graphical notation that is widely used for modeling Business Processes (BP) in Business Process Management (BPM) systems. A key applica-tion of such systems is continuous analysis of BP execution for checking compliance of execution logs with process models. In this paper we introduce a simple, human-readable rule language based on a fragment of First-Order Logic (FOL) and show how compliance rules can be generated directly from BPMN models. We focus on control ﬂow aspects of BPMN models by (1) transforming the model to obtain a uniform representation of task activation (2) dividing the model into sets of components and (3) using our proposed language to generate compliance rules for each component. We show that these rules can be used in the analysis of the business process execution log using British Telecom’s Aperture business process analysis tool.


Introduction
Process mining uses business process logs stored in information systems to gain better understanding about business processes and detect potential breaches between regulations and guidelines specified by process owners and actual execution. In process mining, logs of business event data are compared with the corresponding process model [1]. According to [2] business data are analyzed based on three different perspectives: • Process perspective: the control flow aspects of the process. • Organizational perspective: roles of people such as performers and originators of the business processes. • Case perspective: process-specific properties like location and timing.
The analytics performed on logs depends on the quality and richness of the available data. Activities involved in process mining can be categorized into three types [3]: • Cartography: includes discovering, enhancement, and diagnosis.
• Navigation: includes exploration, prediction and recommendation.
Conformance checking falls under the umbrella of anomaly detection because it provides information about mismatches (often called violations) between logs and process models and helps process owners to understand the causes. Business rules define constrains or guidelines that apply to an organization. Organizations use business rules to enforce policy, comply with legal obligations, communicate between various parties and perform process analysis. A simple example of a business rule expressed in natural language is "A customer can pay in cash or by credit card, but a commission of 3$ is applied to credit card payments less than 20$" . Another example is "Packages weighing over 20 kg must be shipped by sea". In industrial practice, business rules are widely used to assert business structure or to control or influence business behavior [1]. They can apply to people, processes, corporate behavior and computing systems in an organization, and are put in place to help the organization achieve its goals [4].
In this paper, we deal with process-specific rules, i.e. rules that constrain the behavior of a business process in order to achieve a specific goal. These rules can be hidden in source code, inside use cases or in workflow descriptions [5]. Typically, business experts use controlled natural language to write rules based on stake-holders requirements or external regulations, and then compliance experts translate them into the syntax required by the compliance-checking tool used by the organization. Many approaches described in the literature require human intervention for this translation [1]. In this work, we use a simple language to extract logic constraints directly from BPMN models and then translate them into business rules. Using the language, any user can extract the rules easily since they are simple and tool-independent. We build a prototype to extract the logic rules automatically using the XML schema of the BPMN model. Our approach builds on previous work proposed by [6]. In their paper, the authors introduced a mechanism to translate BPMN models to Business Process Execution Language (BPEL), our technique, instead, focuses on the translation of BPMN model to business rules 3 . The rest of the paper is organized as follows. Section 2 highlights conformance checking approaches described in the literature. Section 3 includes various definitions for the BPMN model and its components as well as the logic rules we are proposing. Section 4 presents the case study used to validate our approach. Section 5 concludes the paper and highlights possible future works.

Literature Review
Conformance checking is used to detect violations and inconsistencies between a business process' expected behavior and its real-life executions, providing alerts on detected deviations. Conformance checking can use various types of constraints originated from regulations, laws and business process guidelines [6]. Conformance and business concepts may vary according to business domains and scenarios. This variety has made it difficult to achieve a fully automated conformance checking approach. Some research has been done on using logic for conformance checking [7,8]. Tarantello, Ciccio and Mecella [7] define a declarative process modeling language called Declare, which utilizes Linear Temporal Logic (LTL) to define temporal rules to be verified using process logs. The Declare language focuses on the control-flow perspective by defining different constraints templates such as Existence(A), Absence(A) and Response(A, B). A pattern-based approach that uses LTL and Metric Temporal Logic (MTL) has been introduced in [9]. The authors define both detective and preventive compliance requirements, which can be used to find violations.
Standard BPMN models can be used to define process behavior as they contain decision logic hardwired in their control flow structure. Experience has shown that logic underlying BPMN models can be employed to express business rules. However, few academic papers have studied the extraction of business rules directly from BPMN models, due to the lack of a standard semantics for BPMN. Most process mining techniques studied in the literature represents processes as Petri nets for analysis and rule generation. In [10] the authors proposed the translation of BPMN models into the Object Management Group (OMG)'s standard Semantics of Business Vocabulary and Rules (SBVR) format, which is used to express business rules within OMG's Model Driven Architecture. The authors map different elements of BPMN model into the SBVR metamodel to extract a SBVR vocabulary. The extracted vocabulary is mapped to controlled English in order to write business rules. In [12], the authors present a method for translating BPMN models into rules in a formalized language called XTT2, which is equipped with a simple partial semantics. Their translation technique is based on visual modeling where similar rules are grouped in a table and a process is divided into a network of tables. However, the XTT2 approach does not target automatic compliance checking. More recently, [13] defined an algorithm for business rules analysis that extracts a process schema from the BPMN model and then generates business rules in a syntax called Business Rule Language (BRL). BRL rules are then verified based on the process schema to detect violations. However, the BRL approach only cover a fragment of BPMN as it only deals with "IF" and "THEN" clauses with AND and OR logical operators. Some work is also available on automatic enforcement of business rules in the context of business process. To align business processes with organizations business strategies, the authors in [11] presented SAF, a strategic alignment framework for monitoring organizations. SAF implements monitoring probes, which control the performance of business processes and business strategies achievements. An approach combining BPMN models and logic rules is presented by Awad et al. in [14]. Their main contribution is enabling compliance checking regarding the ordering of activities. A major difference between the approach by Awad et al. and the one proposed in this paper is that they start with a set of externally defined rules and then translate them to temporal logic in order to check the generated model conformance while we start with a BPMN model and use it to generate business rules. Our choice allows the rule designer to exploit standard BPMN process patterns that are widely available for many industries.

Mapping BPMN to FOL
We start by extracting FOL constraints directly from BPMN models. Our constraints will be translated later into business rules. We rely on an initial graph transformation to achieve an implicit uniform task activation semantics; then, we apply the basic definitions given in [6] with some minor variations 4 .

Graph Transformation
We start by translating the BPMN model into a fully synchronous workflow. In BPMN, activity are by default performed synchronously in relation to the invoking process flow, i.e. the process waits for an activity to complete before the process can proceed. However, BPMN syntax allows specifying asynchronous activity execution, e.g. requiring an external event to take place for enabling the execution of an activity. Using asynchronous events (rather than the completion of a previous activity) to enable execution of activities provides a general way to express different enabling semantics. The gist of our transformation is to avoid this complexity by treating synchronization events as special case of ordinary activities, and always use activity enabling by-compilation (of previous activity). In other words, before any analysis, all intermediate events in a BPMN model are transformed to special tasks with double borders to distinguish them. While such transformation may decrease the expressive power of the language, it has the advantage of decreasing the complexity of the model. For the exclusive gateway (XOR), we exclude the default statement, which leads to nothing. The WHILE component will be replaced with REAPEAT to avoid null activity. Summarizing, we perform the following transformations of the BPMN model: a. Conversion of events into activities. b. Elimination of DEFAULT in XOR component. c. Substitution of WHILE with REPEAT component. Figure 1, the intermdiate event e 1 is transformed to a task t 2 . The DEFAULT sequence flow in the switch component is removed. At the end, the WHILE component is substituted with REPEAT component.

Business Process Diagram (BPD)
Business processes are expressed graphically using BPMN elements in a BPD. The model is composed of a set of different tasks, events and gateways referred as objects. A task is a single activity in the model while events can represent  Figure 2 shows the graphical representation of some BPMN elements in a core BPD which is composed of set of objects that can be partitioned into disjoint sets of tasks T , events E and gateways G [6].
In the remainder of the paper, we only consider well-formed core BPDs as defined in [6]. Moreover, without losing generality we assume that both E S and E E are singletons, i.e. E S = {s} and E E = {e}.

Decomposing a BPD into components
The notion of component is used to transform a graph structure into set of business rules. To facilitate this transformation, the BPD is decomposed into different components. Again according to [6] "A component is a subset of the BPD that has one entry and one exit point". Each component will be mapped into a single logic rule. Each component should include a minimum number of two different objects (source and sink). A BPD with no component which only contain a single task between the start and end events is called a trivial BPD. Whenever we reach a trivial BPD, no rule can be extracted and therefore we stop the translation. Breaking down the BPD into set of components helps to define an iterative method to transform BPD into rules. A function Fold is defined in [6] which substitutes a component with single task. Fold function can be utilized to reduce the BPD iteratively until we reach a trivial BPD.

Structured activity-based translation
In our approach, different components are mapped into a subset of FOL rules including AND, XOR and sequence operations. Paper [6] defines seven forms of well-structured components. Figure 3 represents the mapping of each component into the corresponding FOL rules [6].
Each rule corresponds to a specific position in the BPD. The position information can be utilized in different ways in the conformance checking process and introduces two different types of dependencies: sequential and hierarchal dependencies. Sequential order means rules extracted from earlier components should be checked before rules from later components. On the other hand, this technique presents the notion of hierarchy of constraints, which to the best of our knowledge, is not well found in the literature. One or more rules can depend on another rule and therefore executing high-level constraints plays critical role in the execution of other low-level constraints.

Translation Algorithm
After mapping each component to the corresponding rule, we introduce the algorithm used to translation a well-formed core BPD into FOL rule which is similar to the algorithm introduced in [6] with some modifications. The algorithm includes three different steps, selecting a well-structured component then providing its FOL rule and finally fold the component. This is done repeatedly until we reach a trivial BPD. Definition 1 (Algorithm 1 [6]).
Let BPD = (O, F, Cond) be a well-formed core BPD with one start event and one end event.
[X] c is the set of components of BPD[X]

BPMN model to logic rules
To validate our approach, we targeted a reference business process in the telecom industrial domain. Processes in this field of industry have been the target of several interesting studies and research [4] because of the challenges they pose to business rules lifecycle management: telecommunication regulation and policies are frequently updated, while actors' roles change over time. We focus on the telecom order fulfillment process in Figure 4 provided by [16] with some modifications. The process starts whenever an order request is received and then the process initiator acknowledge order. Next, three tasks (Save order in CM, Send order details to Logistics and Obtain IMSI for ICCID) are executed in sequence. If the customer chooses to subscribe only then task Authentication flow will be fulfilled and if he/she chooses subscription with device then MNP wait time is executed. Depending on MNP and new voice/data conditions the sequence flow will branch to MNP process or proceed to choose new data or voice. The customer can choose between Voice subscription process or Data subscription process. Finally, Additional service provisioning is applied followed by Sending an email notification to customer.
Based on the algorithm discussed in Section 3 we show how to extract the logic rules from the order fulfillment model. Seven different components are identified as shown in figure 5 and the model is reduced to trivial BP D. The components are labeled with number i indicating their order and each C i is folded into a task t i C . 1st Translation The algorithm starts with recognizing the sequence component in the model. The component C 1 with five different tasks is folded into task t 1 C with the following logic rule:  2nd Translation After the first fold, another sequence component is identified consisting of tasks Additional services provisioning and send email notification.The component C 2 is folded into task: t 2 C attached with the following rule: R2: ASP → SEN 3rd Translation As no sequence component can be identified in the model, the algorithm tries to allocate any well-structured (non-sequence) component. The switch component C 3 is selected and folded into task t 3 C . The following XOR rule is generated: 6th Translation Folding C 4 simplifies the switch component identified as C 6 that is folded into task t 6 C and rule 6 is extracted: R6: (MNP or New Order?MNP ∧ MP) ⊕ (MNP or New Order?New ∧ t 4 C ) 7th Translation Finally, the sequence component consisting of t 5 C , t 6 C and t 2 C is folded into task t 7 C with the following rule:

Evaluation
We implemented our translation algorithm as a Java program which takes as input the XML incarnation of the source BPMN model. The tool parses XML elements to produce a set of rules. We performed some testing to evaluate our translation tool. Namely, we extracted rules from 10 different BPMN models, obtaining a total of 36 business rules. Table 1 shows that the average recall (defined as the percentage of original business process' components that are covered by the generated rules) is 86.1% while the average precision (defined as the percentage of rules that cover a component of the original business process) is 91.1%. We remark that missing rules are associated with folded components therefore the performance of the tool can be increased either by improving the components folding step or by limited human supervision in the translation process. We need to prove that our language is abstract and independent therefore it can be applied to any tool. For that, we will use WEL to transform the logic rules extracted from the order fulfillment process into WEL business rules that can be directly applied to the tool. Without WHILE or REPEAT control flow structures, all tasks will be executed once and therefore we will use "first" as the selection type. Moreover, all tasks have startTime (sT), endTime (eT) and conditionValue (cV). We assume that there is One-to-One correspondence between the tasks in the BPMN model and Aperture's tasks and therefore we do not need any log lifting. Below, we define our algorithm to translate FOL rules extracted from the BPMN model to Aperture's WEL rules. We start by selecting a rule, finding its equivalent WEL rule and output it.
[X] R is the set of logic rules of BPD[X]. The translated business rules are independent from the log and therefore we kept tasks t i C . These tasks represent temporary tasks and using the log later we will be able to replace them with the corresponding task. For example, t 3 C in R4-WEL will be replaced with either task AF or task MWT based on which tasks was executed and founded in the log.

Conclusion
In this paper, we introduced a pragmatic translation of BPMN models into simple FOL rules reflecting the control flow aspects of the model. Our strategy is based on uniform representation of asynchronous task activation via special synchronous tasks that correspond to checking event queues. The rules we obtain are independent from any software tool and can be used as a baseline to write conformance rules without the need of business expert intervention. In order to validate our approach we extracted business rules from sample BPMN models. These rules were transformed later into the syntax of Aperture, BT's industrial process mining tool. We described and tested an implementation of our translation algorithm.
Future work will involve full automation of the translation process. Components' information can be further utilized to explore the sequential and hierarchal dependencies. This will help ensure that conformance rules are applied in the right time and order.