# Integrating ISA and Part-of Domain Knowledge into Process Model Discovery
## 5 Knowledge-Based Abstraction Operations
### Automatic Abstraction Operators  
We now focus on the operations we provide to perform fully automatic abstraction. In this case, the analysts simply call for one of such abstraction operations, and then the operation is automatically executed, with no further interaction. In such a modality, intersecting paths are not considered, and conflicts are solved automatically by performing  
Figure 6: (**A**) Conflict resolution example in a graph with three occurrences of the path \(\{A_{1}\to A_{2}\to A_{3}\}\), highlighted with a blue box for each occurrence. (**B**) Selected abstraction on the occurrences of the paths, highlighted with a red box for each selected occurrence. (**C**) Resulting model. the abstractions in the ordering they are retrieved by the algorithms (FIFO policy). On the other hand, the interactive procedures will be described in Section 5.3. Algorithms 1 and 2 below describe the procedures we have devised to perform **activity-based** abstraction on a given process model in an automatic way. In detail, the input to the procedure _AutomaticActAbstract_ in Algorithm 1 is composed of various parameters:  
* _KB_: the starting node of the ontological KB;
* _AN_: the node the user wishes to abstract;
* _PM_: the current process model (represented as a graph), which needs to be abstracted, in regard to the instances of node _AN_;
* _AbstrST_: a table maintaining the information of what _KB_ nodes have already been considered for abstraction. The output of the procedure is the process model modified by performing the required abstractions. The procedure _AutomaticActAbstract_ first checks (line 2) whether the requested abstraction is legal (as checked by the procedure _LegalAbstraction?_), a condition that holds that, when _AN_ is not a ground node, it has not been already abstracted, and it is not a descendant of an already abstracted node (to this end, _AbstrST_ is checked). If the abstraction is not legal, a warning is generated (line 3). Otherwise, the _PerformAutAbstraction_ recursive procedure is called (line 5). ```
1:AutomaticActAbstract (KB, AN, PM, AbstrST)
2:if (not LegalAbstraction? (KB, AN, AbstrST)) then
3:signal warning
4:else
5: PerformAutAbstraction (KB, AN, PM, AbstrST)
6:endif
```  
**Algorithm 1** pseudocode of automatic activity-based abstraction algorithm. In turn, _PerformAutAbstraction_ (see Algorithm 2) takes _KB_, _AN_, _PM_, and _AbstrST_ as input. ```
1:PerformAutAbstraction (KB, AN, PM, AbstrST)
2:if (not Abstracted? (AN, AbstrST) and not GroundNode? (KB, AN)) then
3:if IsalNode? (KB, AN) then
4:for each Node in GetSons (KB, AN)do
5: PerformAutAbstraction (KB, Node, PM, AbstrST)
6: Substitute (Find (Node, PM), AN, PM)
7:endfor
8: Add (AN, AbstrST)
9:else
10:if PartOfNode? (KB, AN) then
11:for each Node in GetSons (KB, AN)do
12: PerformAutAbstraction (KB, Node, PM, AbstrST)
13:endfor
14: Substitute (Exec (AN, PM), AN, PM)
15: Add (AN, AbstrST)
16:endif
17:endif
18:endif
```  
**Algorithm 2** pseudocode of the recursive automatic abstraction algorithm. In the recursive procedure, the base case is represented by the check at line 2: _PerformAutAbstract_ will end if _AN_ has already been considered for abstraction (as checked by the procedure _Abstracted_?, which verifies whether \(AN\) is present as an entry in the abstraction table _AbstrST_) or it is a ground node (as checked by the procedure _GroundNode_?). In the general case, two situations are possible. The first situation (lines 3-8) occurs when \(AN\) is an ISA node. In such a case, the algorithm recursively calls _PerformAutAbstraction_ on each son of \(AN\) (line 5) and then substitutes \(AN\) for each son (identified through the procedure _Find_) everywhere in the model (line 6). Then, through the function _Add_, the algorithm adds \(AN\) to the abstraction table _AbstrST_, so that it will not be considered again for abstraction in the future (line 8). The second situation (lines 9-17) holds when \(AN\) is a part-of node.