# Integrating ISA and Part-of Domain Knowledge into Process Model Discovery
## 5 Knowledge-Based Abstraction Operations
### Interactive Abstraction Operators
In the case \(N\) is a part-of node (lines 15-16), the algorithm, through the function _Exec_ (the same one used by Algorithm 2), looks for all paths \(P\) in _PM_ that match the part-of relation defined by \(N\) and adds them to the set _Paths_ (line 15) as a pair \(<\)\(P\), \(N>\); the algorithm also updates the abstraction table _AbstrST_ to indicate that \(N\) has been considered for abstraction (line 16). After considering all nodes in _Nodes_, the algorithm partitions the elements of _Paths_ (i.e., the paths that could be abstracted) into non-overlapping sets (line 22). Notably, unitary sets can also be part of the output of this step (to consider abstraction paths that do not intersect any other abstraction path in the process model). Finally, for each resulting set from the above partitioning, the algorithm manages (interactively with the analysts) the related abstractions by invoking the _SolveAndAbstract_ algorithm (lines 23-25). The purpose of the _SolveAndAbstract_ algorithm (see Algorithm 4) is to abstract a set of paths \(T\) in a given process model _PM_, which can be abstracted to specific part-of nodes by interacting with the user to solve conflicts, managing intersecting paths, and possibly choosing not to perform the abstraction of specific paths (to support selective abstraction). The algorithm takes the following parameters as input:  
* _T_: a set of intersecting paths that needs to be abstracted; each element is a pair \(<\)\(P\), _AN\(>\)_, where \(P\) is a path of the process model _PM_ (see below), and _AN_ is the part-of node, in which \(P\) may be abstracted;
* _PM_: the current process model that needs to be abstracted. ```
1:SolveAndAbstract(\(T\), PM)
2:\(A\leftarrow\) AskAbstractions(\(T\), PM)
3:PathsToKeep\(\leftarrow\)AskPaths(\(A\), PM)
4:NodesToDelete\(\leftarrow\)\(|\)
5:ArcsToDelete\(\leftarrow\)\(|\)
6:for each\(<\)X,AN\(>\) in Ado
7:\(N\leftarrow\) CreateNode(AN, PM)
8:CreateArcs (\(N\), GetInArcs (X, PM), GetOutArcs (X, PM))
9:NodesToDelete\(\leftarrow\)NodesToDelete\(\cup\) GetPathNodes (X)
10:ArcsToDelete\(\leftarrow\)ArcsToDelete\(\cup\) GetInArcs (X,PM)\(\cup\) GetOutArcs (X, PM)\(\cup\) GetPathArcs (X)
11:endfor
12:for each\(P\) in PathsToKeepdo
13:NodesToDelete\(\leftarrow\)NodesToDelete--GetPathNodes (\(P\))
14:ArcsToDelete\(\leftarrow\)ArcsToDelete--GetPathArcs (\(P\))
15:endfor
16:Delete (PM, NodesToDelete, ArcsToDelete)
```  
**Algorithm 4**pseudocode of the conflict resolution and abstraction algorithm. The algorithm starts with a call to the _AskAbstractions_ procedure (line 2), which asks the analysts to select zero or more paths in \(T\) to be abstracted (such paths are stored in \(A\); line 2). Notably, the analysts can: (i) select only paths which have no intersection between them, and (ii) select no paths in \(T\) (i.e., choose to not perform any abstraction in \(T\); please remember that \(T\) may also be a unitary set, in cases where an abstraction path has no intersection with any other abstraction paths). In such a way, _AskAbstractions_ accomplishes user-driven _conflict resolution_ and implements _selectivity_ in the application of abstractions. On the other hand, the procedure _AskPaths_ in line 3 asks analysts which _intersecting paths_ they want to preserve (if any) and stores them in the _PathsToKeep_. Subsequently (lines 6-11), the algorithm performs the abstractions in \(A\). Specifically, for each path \(X\) to be abstracted into \(AN\), the algorithm creates in \(PM\) a new node \(N\) with the same label of \(AN\) (line 7) and connects it to all nodes of \(PM\) that are connected with one or more nodes of \(X\) (i.e., for all edges (\(U\),\(V\))), such that for \(U\
otin X\) and \(V\in X\), the algorithm creates a new edge (\(U\),\(N\)), and for all edges (\(U\),\(V\)), such that \(U^{\prime}\in X\) and \(V^{\prime}\
otin X\), the algorithm creates a new edge (\(N\),\(V^{\prime}\)) (line 8).