# 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.2 Entity Fusion Algorithm Based on Weighted Average of Attribute Similarities  
Entity fusion is used to identify and merge domain knowledge subgraphs that describe the same entity under the same subgraph template to eliminate redundant information and provide a consistent and accurate representation of the entity. The entity fusion algorithm based on the weighted average of attribute similarity is a common entity fusion method [29]. It compares the similarity of attributes of entities and assigns weights to each attribute to finally calculate a comprehensive entity representation. The entity fusion algorithm based on attribute similarity weighted average is as follows:  
Step 1: Load the domain knowledge subgraph set \(Result=\{SG_{1},SG_{2},\ldots,SG_{n}\}\) and set \(i=1\).  
Step 2: Obtain the attribute vector \(W_{j}\) of each element in the subgraph set \(SG_{i}\) of domain knowledge subgraphs.  
For each subgraph element in the domain knowledge subgraph set \(SG_{i}\), read its associated attribute values as attribute information, store the attribute information in vector form, and obtain the attribute vector \(W_{j}=\big{[}W_{j1},W_{j2},\ldots,W_{jm}\big{]}\) for each subgraph element.  
Step 3: Calculate the similarity score vector \(sim(W_{p},W_{q})\) between two subgraph elements in the set \(SG_{i}\).  
\[sim\big{(}W_{p},W_{q}\big{)}=\big{[}sim(W_{p1},W_{q1})\quad sim \big{(}W_{p2},W_{q2}\big{)}\quad\cdots\quad sim\big{(}W_{pm},W_{qm}\big{)} \big{]} \tag{5}\]where \(W_{px}\) is the ith attribute value of the x-th attribute of the subgraph element \(p\), and \(sim\big{(}W_{px},W_{qx}\big{)}\) is the similarity value between the subgraph element \(p\) and the subgraph element \(q\) at the x-th attribute component, which is calculated using the minimum edit distance algorithm [30].  
Step 4: Calculate the weighted average of the similarities between the elements of the two subgraphs in the set \(SG_{i}\);  
\[\overline{sim}\big{(}W_{p},W_{q}\big{)}=\sum_{i=1}^{m}\frac{1}{m}\cdot sim \big{(}W_{pi},W_{qi}\big{)} \tag{6}\]  
Step 5: Merge the subgraph elements with \(\overline{sim}\big{(}W_{p},W_{q}\big{)}\geq 0.8\) to obtain the fused subgraph set \(N\_SG_{i}\).  
Step 6: If \(i<n\), then \(i=i+1\) and go to Step 2; if \(i=n\), then go to Step 7.  
Step 7: Export the subgraph fusion result \(Result=\{N\_SG_{1},N\_SG_{2},\dots,N\_SG_{n}\}\).  
The modeling algorithm proposed in this section provides an important technical support for the efficient construction of knowledge graphs for task planning. However, pure theoretical derivation cannot prove the practical value of the algorithm. In the next section, this paper will take the space-station mission-planning domain as an example to comprehensively validate the proposed business-model-driven mission-planning knowledge graph construction framework method and the practical effect of the matching algorithm, which consists of three parts, namely, experimental preparation, result validation, and analyzing and evaluating.