# Cosine-Based Embedding for Completing Lightweight Schematic Knowledge in DL-Lite\({}_{core}\)+
## 4 Method
### The Score Functions of CosE  
As CosE projects the concepts of all the axioms into two types of semantic spaces, we define the corresponding score functions to evaluate the score of axioms in these two semantic spaces. Given an axiom \((C_{i},r,C_{j})\), its score function is defined as:  
\[f(C_{i},r,C_{j})=f_{a}(C_{i},r,C_{j})+f_{t}(C_{i},r,C_{j}), \tag{3}\]  
where \(f_{a}(C_{i},r,C_{j})\) is score function defined in the angle-based semantic space, and \(f_{t}(C_{i},r,C_{j})\) is one designed for translation-based semantic space.  
For the score function \(f_{a}(C_{i},r,C_{j})\) in angle-based semantic space, we assume that the relations with different properties should be measured by different score functions. For an axiom \((C_{i},r_{s},C_{j})\) with a \(subclassOf\) relation denoted by \(r_{s}\), CosE encodes concepts \(C_{i}\) and \(C_{j}\) as \((\mathbf{C_{i}},\mathbf{m})\) and \((\mathbf{C_{j}},\mathbf{n})\), where \(\mathbf{C_{i}}\) and \(\mathbf{C_{j}}\) are the vectors of \(C_{i}\) and \(C_{j}\), and \(\mathbf{m}\) and \(\mathbf{n}\) are two external vectors introduced to obtain the valid lengths of \(C_{i}\) and \(C_{j}\) for preserving the direction of transmission between the projected concepts. The score function of axiom \(f_{a}(C_{i},r_{s},C_{j})\) designed for \(subclassOf\) relation is defined as follows.  
\[f_{a}(C_{i},r_{s},C_{j})=1-cos(\mathbf{C_{i}},\mathbf{C_{j}})+||\mathbf{m}||_{ 2}-||\mathbf{n}||_{2}, \tag{4}\]  
where \(\mathbf{C_{i}}\in\mathbb{R}^{n}\) and \(\mathbf{C_{j}}\in\mathbb{R}^{n}\) are two vectors corresponding to \(C_{i}\) and \(C_{j}\), and \(||\mathbf{m}||_{2}\) and \(||\mathbf{n}||_{2}\) are two valid lengths of \(C_{i}\) and \(C_{j}\). Note that these vectors are all parameters that need to be learned during the process of model training.  
For an axiom \((C_{i},r_{d},C_{j})\) with \(disjointWith\) relation denoted by \(r_{d}\), the length constraints of vectors are removed so as to preserve the symmetry of the \(disjointWith\) relation. The score function corresponding to \((C_{i},r_{d},C_{j})\) is defined as follows.  
\[f_{a}(C_{i},r_{d},C_{j})=1-cos(\mathbf{C_{i}},\mathbf{C_{j}}), \tag{5}\]  
where \(\mathbf{C_{i}},\mathbf{C_{j}}\in\mathbb{R}^{n}\) are the vectors of \(C_{i}\) and \(C_{j}\) in the angle-based semantic space.  
Although the above score functions designed for angle-based semantic space can preserve the properties of \(subclassOf\) and \(disjointWith\), it still cannot measure the confidences of axioms with these two relations well. This is because \(subclassOf\) and \(disjointWith\) are typical multivariate relations. To address this problem, we introduce a new score function for each axiom in translation-based semantic space to achieve this goal, as follows.  
\[f_{t}(C_{i},r,C_{j})=||\mathbf{C_{i\perp}}+\mathbf{r-C_{j\perp}}||_{2}, \tag{6}\]  
where \(\mathbf{r}\) is the vector representation of relation \(r\), and \(\mathbf{C_{i\perp}}\) and \(\mathbf{C_{j\perp}}\in\mathbb{R}^{n}\) are two projected vectors generated by Formulas (1) and (2) in translation-based semantic space. During the training process of CosE, we need to enforce the constraints such that \(||\mathbf{C_{i}}||_{2}\leq 1\), \(||\mathbf{C_{j}}||_{2}\leq 1\), \(||\mathbf{C_{i\perp}}||_{2}\leq 1\), and \(||\mathbf{C_{j\perp}}||_{2}\leq 1\).  
Notice that the relation's own transitivity or symmetry can also be modeled via the function of angle-based semantic space, and the normal relations without logical properties can be modeled via the function of translation-based semantic space.