Using binary relations over sets to solve a practical problem
When developing a computer system for managing business processes, we were faced with the problem of appointing specific performers.
There are two traditional approaches to the implementation of this purpose:
The binary relation for finite sets A and B can be defined by defining a set of ordered pairs in which the first element belongs to the set A and the second to the set B. The following shows how this simple concept helps to solve the task of initializing the role of a business process.
Process control automation systems distribute tasks to executors in accordance with business process schemes, as well as monitor their implementation
Roles in a business process are used to associate the nodes of a business process with job performers. When developing a business process, a role is created and put into correspondence with certain nodes of the business process diagram. Initialization of a role is an assignment to a role of a specific executor.
In a business process, as a rule, at the time of its launch, the values of some roles are already known. For example, it is known which user started the business process. In most cases, you need to find values for other roles from known role values. If an employee of the enterprise has launched the business process of filling out an application for some resource, then the head of this employee must confirm or refuse this application. That is, in order to initialize new roles according to the values of the already initialized roles, it is necessary to somehow set the relations between the employees of the enterprise.
Pondering this problem, I remembered that at Moscow State University, in my second year, I studied binary relations over sets. If the employees of an enterprise are considered as elements of a multitude, then with the help of this design it is just possible to define ordered relationships between employees.
Then the role can be initialized as follows:
1. We set binary relations for many employees of the enterprise, which are sets of ordered pairs of employees.
2. For roles of business processes initialized using binary relations, we indicate the role already known at the time of initialization.
3. In the procedure for assigning an executor to a role, we take the value of the executor of the already known role associated with the initializer. This value will correspond to the right side of the binary relation. We construct a set of values of all left elements of relationship pairs in which the right element coincides with the performer of an already known role.
4. By this set we initialize the role. The fact that in this case the role may have more than one possible executor is not scary: all possible executors will be sent the corresponding task, but only one executor will complete it, the one who will take the task for execution first.
However, specifying binary relations by listing all the pairs of artists that define it is not always convenient, since there can be many such pairs. Therefore, we expand the set on which binary relations are determined. In addition to performers, we also allow the use of performer groups in pairs.
Then, according to the already known role, we will select the pairs in the right part of which there is either a performer - the value of this role, or a group containing this performer. Thus, the number of pairs defining the ratio can be significantly reduced.
The algorithm was implemented in practice - in a free open-source system RunaWFE. Another item was added to the main menu of the system - Relations:

At this point you can see / add / delete a relationship, open a relationship and edit the many pairs of its components:

In the editor in the business process, when editing the role initializer, you can select the tab "Define the role using the relationship." In this case, you can configure the connection to the server and import the relationships into the editor:

Next, the relationship can be mapped to the role. The form selects the name of the relationship and the variable or constant corresponding to the right side of the relationship that defines the user or group of users:

There are two traditional approaches to the implementation of this purpose:
- Inside the system, the organizational structure of the enterprise is defined and the role is assigned by specifying the parameters of this structure
- The role initialization procedure is transferred to some other information system
- The organizational structure of the enterprise is a separate entity and it is undesirable to place it in the business process management system, as this greatly complicates the system.
- Removing a role to another system and organizing a remote procedure call from this system is a complex technical task
The binary relation for finite sets A and B can be defined by defining a set of ordered pairs in which the first element belongs to the set A and the second to the set B. The following shows how this simple concept helps to solve the task of initializing the role of a business process.
Process control automation systems distribute tasks to executors in accordance with business process schemes, as well as monitor their implementation
Roles in a business process are used to associate the nodes of a business process with job performers. When developing a business process, a role is created and put into correspondence with certain nodes of the business process diagram. Initialization of a role is an assignment to a role of a specific executor.
In a business process, as a rule, at the time of its launch, the values of some roles are already known. For example, it is known which user started the business process. In most cases, you need to find values for other roles from known role values. If an employee of the enterprise has launched the business process of filling out an application for some resource, then the head of this employee must confirm or refuse this application. That is, in order to initialize new roles according to the values of the already initialized roles, it is necessary to somehow set the relations between the employees of the enterprise.
Pondering this problem, I remembered that at Moscow State University, in my second year, I studied binary relations over sets. If the employees of an enterprise are considered as elements of a multitude, then with the help of this design it is just possible to define ordered relationships between employees.
Then the role can be initialized as follows:
1. We set binary relations for many employees of the enterprise, which are sets of ordered pairs of employees.
2. For roles of business processes initialized using binary relations, we indicate the role already known at the time of initialization.
3. In the procedure for assigning an executor to a role, we take the value of the executor of the already known role associated with the initializer. This value will correspond to the right side of the binary relation. We construct a set of values of all left elements of relationship pairs in which the right element coincides with the performer of an already known role.
4. By this set we initialize the role. The fact that in this case the role may have more than one possible executor is not scary: all possible executors will be sent the corresponding task, but only one executor will complete it, the one who will take the task for execution first.
However, specifying binary relations by listing all the pairs of artists that define it is not always convenient, since there can be many such pairs. Therefore, we expand the set on which binary relations are determined. In addition to performers, we also allow the use of performer groups in pairs.
Then, according to the already known role, we will select the pairs in the right part of which there is either a performer - the value of this role, or a group containing this performer. Thus, the number of pairs defining the ratio can be significantly reduced.
Implementing a role initialization algorithm
The algorithm was implemented in practice - in a free open-source system RunaWFE. Another item was added to the main menu of the system - Relations:

At this point you can see / add / delete a relationship, open a relationship and edit the many pairs of its components:

Initializing a role using a binary relation in a business process editor
In the editor in the business process, when editing the role initializer, you can select the tab "Define the role using the relationship." In this case, you can configure the connection to the server and import the relationships into the editor:

Next, the relationship can be mapped to the role. The form selects the name of the relationship and the variable or constant corresponding to the right side of the relationship that defines the user or group of users:
