# An Embedding-Based Approach to Repairing OWL Ontologies
## 3 Approach
### Information Preparing
For instance, the following vector with large dimensions is obtained by applying the model Sentence-BERT (i.e., m1 introduced in Section 5.2) to represent the sentence \"Parent is a kind of Animal\":  
\[(0.08,0.25,0.15,0.39,-0.43,-0.20,0.14,0.03,0.38,0.09,...,-0.01,0.67,0.07).\]  
With the obtained vectors, the semantic similarity between two axioms/sentences is calculated. Suppose we have two vectors \(v_{1}\) and \(v_{2}\), both of which have \(d\) dimensions. Two similarity metrics can be defined based on the widely used distance measures Cosine Distance and Euclidean Distance. Definition 5: The similarity metric based on Cosine Distance (marked as \(sim_{cos}\)) is formally defined as below:  
\[sim_{cos}(v_{1},v_{2})=\frac{1}{2}(1+\frac{v_{1}\cdot v_{2}}{||v_{1}||\times|| v_{2}||})=\frac{1}{2}(1+\frac{\sum_{i=1}^{d}v_{1i}\times v_{2i}}{\sqrt{\sum_{i=1}^{d} (v_{1i})^{2}}\times\sqrt{\sum_{i=1}^{d}(v_{2i})^{2}}})\]  
Here, \(v_{1i}\) and \(v_{2i}\) indicate the \(i\)th element in the vectors \(v_{1}\) and \(v_{2}\), respectively. \(d\) is the dimension of \(v_{1}\) or \(v_{2}\), both of them have the same dimension. Definition 6: The similarity metric based on Euclidean Distance (marked as \(sim_{euc}\)) is defined as below:  
\[sim_{euc}(v_{1},v_{2})=\frac{k}{k+\sqrt{\sum_{i=1}^{d}(v_{1i}-v_{2i})^{2}}}\]  
Here, \(k\) indicates a positive integer. \(d\) is the dimension of \(v_{1}\) or \(v_{2}\), both of which have the same dimension. The similarities computed by Definitions 5 and 6 range from 0 to 1 because the two original distance metrics have been normalized. Especially in Definition 6, a positive integer \(k\) is used for normalization. The greater the integer \(k\), the larger the similarity \(sim_{euc}\). Thus, \(k\) is set to be 4 in our evaluation because the similarities could be evenly distributed within (0, 1) according to our observations. In addition, the two metrics are reflexive because \(sim(v,v)=1\) for any vector \(v\). They are also symmetric since \(sim(v_{1},v_{2})=sim(v_{2},v_{1})\) for any vectors \(v_{1}\) and \(v_{2}\). Here, \(sim\) can be \(sim_{cos}\) or \(sim_{euc}\). Example 2: Take the following axioms in the ontology km1500 as examples. \(a1:\)\(SubClassOf(information\_kernel\_technology\_ctechnology\_c)\)  
\(a2:\)\(ObjectPropertyDomain(boost\_rtechnology\_c)\)  
\(a3:\)\(SubClassOf(technology\_cinformation\_resource\_c)\)  
By applying the cosine similarity metric, we obtain  
\(sim_{cos}(a1,\ a2)=0.36\) and \(sim_{cos}(a1,\ a3)=0.9\)  
The similarity between axioms \(a1\) and \(a2\) is 0.36, which is quite different from that between axioms \(a1\) and \(a3\) (i.e., 0.9), although both pairs have shared entities. It is because \(a1\) and \(a2\) have different axiom types while both \(a1\) and \(a3\) belong to subsumption. It is noted that, wekeep the similarities between axioms and the ranks of axioms to two decimal places by rounding. The main reason is that we ignore the slight difference between two values such as 0.563 and 0.564. In this way, multiple axioms can have more chance to share the same rank in a MUPS or MIPS, and it becomes possible to find multiple diagnoses and choose one of them as a final repair solution. In our approach, another preparation task is to compute all MIPS for each ontology. The computation of MIPS could rely on all MUPS of all unsatisfiable concepts in an ontology [22], or be computed directly [20]. A single MUPS can be computed by applyinga black-box approach or a glass-box approach, and all MUPS of an unsatisfiable concept are often computed based on the hitting set tree algorithm [19; 38]. Of course, it may not be always desired to compute MIPS when resolving incoherence due to the efficiency problem, but we focus on computing diagnoses based on all MIPS of an ontology.