# A Business-Model-Driven Approach to Task-Planning Knowledge Graph Construction
## 4 Model and Algorithm
### Domain Knowledge Classification Algorithm Based on Ullman Subgraph Matching
#### 4.2.1 Improved Ullman-Subgraph-Matching Algorithm  
The subgraph-matching algorithm is used to find a subgraph isomorphic to a given small graph in a large graph [27]. The improved Ullmann-subgraph-matching algorithm mainly expands the generation and representation methods of the adjacency matrix on the basis of the original Ullmann-subgraph-matching algorithm [28], enabling it to express complex networks with multiple relationships, thereby achieving the matching of domain knowledge subgraphs in the business data graph that are isomorphic to the subgraph templates defined by the top-level ontology. The improved Ullmann-subgraph-matching algorithm takes the business information graph and ontology network as input and obtains the domain knowledge subgraph corresponding to each subgraph pattern structure in the business information graph as output. The specific calculation process of the algorithm is as follows:  
Step 1: Summarize and organize all the associated attributes (including object attributes and data attributes) in the ontology network to form a list of associated attributes \(P\) of the ontology network. Step 2: Divide the ontology network into a set of templates \(Q=\{Q_{1},Q_{2},\ldots,Q_{n}\}\). For each concept node \(q_{i}\) in the ontology network, a list of associated attributes \(p_{i}\) of the concept node is extracted from the ontology network, and the concept node or data type \(v_{i}\) corresponding to each associated attribute in the list is obtained to form a list of associated attribute values, thereby forming a subgraph template \(Q_{i}=\{q_{i};p_{i};v_{i}\}\) of the concept node \(q_{i}\). Step 3: Obtain the adjacency matrices of each subgraph template to form the set of subgraph adjacency matrices \(MA=\{MA_{1},MA_{2},\ldots,MA_{n}\}\). For each subgraph template \(Q_{i}\) in the subgraph mode collection, the concept nodes and associated attribute value lists are summarized to form a subgraph adjacency matrix index list \(s_{i}=[q_{i},v_{i}]\). The element values in the subgraph adjacency matrix \(MA_{i}\) are set according to the following rules:  
\[MA_{i}[i][j]= \begin{cases}index[p],&s_{i}[i]\xrightarrow{\exists p\in P}s_{i} [j],\\ 0,&else.\end{cases}  \tag{1}\]  
where \(s_{i}[i]\xrightarrow{\exists p\in P}s_{i}[j]\) represents that, for element \(s_{i}[i]\), there is an associated property \(p\) belonging to the associated property list \(P\), which associates it with element \(s_{i}[j]\); \(index[p]\) is the index value of the relationship \(p\) in the ontology network associated property list \(P\). Step 4: Obtain the adjacency matrix M of the business data graph \(G\). For the business data graph \(G\), the internal concept node list \(GQ\) and the associated attribute value list \(GV\) are sorted and compiled to form the adjacency matrix index list \(S=[GQ,GV]\) of the business data graph \(G\). The internal element values of the adjacency matrix \(MB\) of the business data graph \(G\) are set according to the following rules:  
\[MB[i][j]= \begin{cases}index[p],&S[i]\xrightarrow{\exists p\in P}S[j],\\ 0,&else.\end{cases}  \tag{2}\]  
where \(S[i]\xrightarrow{\exists p\in P}S[j]\) represents that, for element \(S[i]\), there is an associated property \(p\) belonging to the associated property list \(P\), which associates it with element \(S[j]\); \(index[p]\) is the index value of the relationship \(p\) in the ontology network associated property list \(P\). Step 5: Generate the search space matrix for each subgraph pattern to form the search space matrix set \(M=\{M_{1},M_{2},\ldots,M_{n}\}\). For the domain knowledge subgraph template \(Q_{i}\), the element values of the search space matrix \(M\) are set according to the following rules:  
\[M_{i}[i][j]= \begin{cases}1,&(\alpha\times n(s_{i}[i])\leq n(S[j]))\&(d_{+}(s_ {i}[i])\leq d_{+}(S[j])),\\ 0,&else.\end{cases}