In this part, firstly, the basic idea of the CFR is introduced, and then, its specific process and implementation method is elaborated in detail. Finally, the evaluation metrics of reasoning performance is put forward.
3.1. Basic Idea of the CFR
The reasoning task of large-scale ABox reasoning is mainly considered, so we presume the TBox of a given ontology KB is correct and complete. In order to formally describe the basic idea of the CFR, the definitions of related concepts are given at first.
Definition 1. For a given OWL DL ontology KB, it is called origin KB, denoted as , and the knowledge base obtained based on logic reasoning is called extensional KB, denoted as . Ignoring the specific details, the reasoning process based on description logic is called ontology reasoning, which is denoted as .
According to Definition 1, the process of ABox reasoning can be expressed as:
If ontology reasoning is regarded as a function in a broad sense, the above formula can be converted into:
where the input is
and the output is
;
can be thought of as a mapping function from input to output.
The theory has proved that the deep neural network can effectively approximate to functions [
43]. For an NN model
, if
is used as the input and
is used as the supervision (output), where:
Under the condition that the expression ability and learning ability of
are strong enough, after sufficient training, the mapping relationships from
to
can be effectively learned. It can be considered that the parameter learning of the
is an approximate compilation of the deduction process of ontology reasoning, which is expressed as:
With the support of computer software and hardware for tensor computing and parallel computing of deep learning, the has higher computing efficiency and better scalability for large-scale ABox reasoning than .
The above idea is theoretically feasible, but it still faces two major challenges. Firstly, the input of the model is real-valued vectors, and ABox is usually represented by symbols, so how to input ABox into the is a problem. Secondly, the input layer parameters of the are fixed and usually should not be overmuch, so how to input a large-scale ABox into the is another problem.
Definition 2. A class assertion indicates that instance e is the instance of class C; a role assertion represents that there is a relation r between instances s and o. A collection of class assertions and relation assertions is called an assertional box (ABox).
Let us start with the first challenge. In Definition 2, there are two kinds of assertions in ABox, class assertion
and role (or relation) assertion
, where class
C and role
r are defined in TBox. Class assertion is a unary predicate, and role assertion is a binary predicate. Both can be uniformly expressed as RDF [
44] triple representation, which is a very common expression in semantic web and a lossless transformation. Then, these two assertions can be expressed as:
Based on the triple representation, ABox can be converted into numeric values. The common method is KG representation learning, but this is a lossy transformation. We expect to achieve a greater degree of approximation of the reasoning process, so the form of adjacency matrix is adopted. The adjacency matrix can only represent a single role among entities; however, there are many kinds of roles in ABox, so we adopt the method of a multi-layer adjacency matrix [
39]; that is, the assertion involved in each type of role in ABox is expressed as an adjacency matrix, and finally, all the adjacency matrices are assembled to form a multi-layer adjacency matrix, the number of layers is equal to the role number
in ABox, including the class assertion
-
A. At the same time, in order to realize end-to-end learning, it is necessary to record the corresponding role and entity dictionary of each layer of the adjacency matrix in the process of encoding a multi-layer adjacency matrix so as to ensure the reversible process from the multi-layer adjacency matrix to ABox. The concept definition is given below.
Definition 3. The process of encoding ABox in ontology KB into a multi-layer adjacency matrix is called multi-layer adjacency matrix encoding, which is recorded as . The inverse process is called multi-layer adjacency matrix decoding, which is denoted as .
Then comes the second challenge. For large-scale ABox, if we input it to the at one time, this will result in two defects. First, the scale of ontology KB used for model training and the real KB that need to be inferred may be inconsistent, and the scale of ABox of KB in the real world may change constantly, which makes it difficult to fix the parameters of input layers of the . Second, large-scale ABox is usually difficult to input at one time due to the limitation of computer characteristics, and even if it can be input, it will lead to too many parameters in the input layer of the , which is difficult to train. We alleviate these defects by segmenting subgraphs of instances. The subgraph of instances is defined as follows.
Definition 4. Let e be an instance in a given ontology KB; then, the subgraph formed by its adjacency entities and roles (or relations) centered on e in ABox is called the subgraph of instance e, which is named .
According to Definition 4, if all instances in the KB are traversed, ABox in the KB can be expressed as:
where
represents the ID of instances in the KB,
, and
N represents the number of instances in ABox.
The input of large-scale ABox can be solved by subgraph segmentation. The reason is that even though the scale of ABox of training data and real KB are quite different, the sizes of those subgraph are usually not much different for a single instance. In addition, through subgraph segmentation, the number of training data can be increased, so training effect of the can be improved, since it is data-driven.
Definition 5. For a given ontology KB, which is denoted as , let e be an instance in ABox and its corresponding subgraph be . If holds, then is called the extended subgraph corresponding to instance e.
The training of the depends on the supervision. We take the extended subgraph as the supervision data to train the , as shown in Definition 5. The extended subgraph of an instance is obtained by ontology reasoning under the complete TBox, which can ensure that it is correct and complete. Thanks to subgraph segmentation, the size of the subgraph of each instance is relatively small, so the cost of obtaining an extended subgraph will be greatly reduced.
According to Equations (
2) and (
6) and Definition 5,
can be expressed as:
Obviously, the establishment of the above formula requires a precondition: that is, whether the ABox reasoning result on the whole ABox can be approximated by the collection of extended subgraphs. Ref. [
7] gives relevant verification and proves that this approximation is established.
We regard
corresponding to the instance
as a piece of training data, where the subgraph
is the input data and the extended subgraph
is the supervision data, so a total of
N pieces of training data can be constructed on the whole ABox. According to Definition 5, every training data contains a complete logical deduction process. If the
is constructed to learn the mapping relationships from the subgraph of an instance to its extended subgraph, that is:
Then, the can learn the general logical deduction calculus: that is, the process of deductive reasoning. Although the subgraph of each instance contains only fragmentary information in ABox, the complete deductive reasoning process can be learned by the trained on the subgraph of all instances for many cycles.
In the testing (or reasoning) phase of the
, if a subgraph
of an instance
is input, then its corresponding extended subgraph is output, which is:
Then, after traversing the subgraphs corresponding to all instances in the test data, the extended ABox (Equation (
7)) can be expressed as:
In the above formula, is the extended ABox reasoning result obtained through the NN method. We think it is an effective approximation of the reasoning result to the ontology reasoning, the structure and parameters of the approximately compile the deductive process of logical reasoning.
3.2. Framework of the CFR
In this section, we introduce the overall framework of the CFR. The framework is shown in
Figure 1. It is mainly divided into two parts: model training and reasoning (or testing). In the figure,
indicates the number of instances in the synthetic ABox,
indicates the number of instances in the ABox of the real KB, and the meanings of other notations are the same as those in
Section 3.1.
In model training, the large-scale ABox is synthesized based on the TBox to form the synthetic ontology KB. On this basis, the subgraphs of
in the synthetic ontology KB are divided to obtain the subgraph
for each instance, and all the subgraphs constitute the input subgraph dataset. Then, the subgraph in the input subgraph dataset are merged with the complete TBox, and the corresponding extended subgraph
is obtained by the ontology reasoner Pellet, thus forming the extended subgraph dataset. The subgraph and its correspondingly extended subgraph
constitute a piece of training data. With the help of
and
, a reversible mapping from the symbol to the multi-layer adjacency matrix is constructed, and a fully convolutional neural network (FCNN) [
45] is trained to learn the mapping relationships from the input subgraph to the extended subgraph.
In model reasoning (or testing), ABox in the real OWL DL KB is divided into subgraphs by the same method, and the subgraph of each instance is obtained, forming the input subgraph dataset. Each subgraph is encoded in turn by the and is input to the FCNN; then, the output result is decoded by the . By restoring the result into RDF triple representation and then obtaining the extended subgraph corresponding to each subgraph, we form the approximately extended subgraph dataset. Finally, all the extended subgraphs are merged to obtain a large-scale extended . With the above framework, the CFR implements the approximate reasoning task for large-scale ABox.