JSON Logic for BPM: The way Rindap manages complex business rules

Articles

In Business Process Management (BPM) systems, the operating rules of business processes and workflows are mostly structured and managed based on logic principles. There is a need for logic constructions to establish rules for components such as determining the status of tasks and resources, assigning them to Workers, specifying operational constraints, directing processes and triggering events. The use of JSON Logic for BPM is very crucial here.

JSON Logic structure, built on JavaScript Object Notation (JSON). Rindap uses JSON logic for BPM for the creation of complex business rules and scenarios. Utilizing JsonLogic structure, serialize rules as JSON data, share between front-end and back-end of applications and store rules in databases. 

Each Json Logic rule is a JSON object and is defined as an operator-data pair.

In a JSON Logic structure, the operator is in the key position while one or several arguments are in the value position. Each argument itself can be a logic rule, so it is possible to define complex rules with JsonLogic. 

{“operator” : [“values” … ]}

The following is an example of a simple JsonLogic business rule. In that rule, there is a comparison of two elements of an array. If they are equivalent to each other, the rule’s result will be TRUE, else the result will be FALSE. If the result is TRUE, defined actions will happen. 

{ “==” : [1, 1] }

JSON Logic rule parsers can transform written rules into statements in e.g. Python, JavaScript, PHP and Ruby and provide the execution of these rules. For instance, we can achieve Python counterpart of the above JSON Logic as follows:

Python code:  (1 == 1 ) 

JsonLogic is a powerful alternative to rule-based creation of complex business processes. Especially as it allows rules to be stored as data and thus dynamically generated by user interaction.

Managing business rules

Business rules define specific directives or constraints that tell organizations how to take actions, make decisions about their business activities. These rules can apply in many businesses such as customer relations management, clinical pathway system, booking a hotel room, etc. 

As an example of a business process, suppose a booking agency wants to automate booking a hotel room. To do that, a set of questions will be asked to determine availability, price and rate of the hotel based on the person’s responses. For example, location, size and type of service offered are the key factors of choosing a hotel room for a person. If the distance of the hotel to the beach is less than 100 meters, the number of hotels’ rooms is greater than 50 and they offer breakfast, the hotel suggestion will be taken. The following is a simple JSON Logic for BPM example. 

Itea
Tubitak
Rindap benefits from the experience of taking active role in the projects run by TÜBİTAK and ITEA respectively. Rindap is a part of the solutions offered by these projects to increase innovation and business impact.