Ontology/KB/Memory Based Inferences
by
Adil KABBAJ
Ontology/KB/Memory Based Inferences
Ontology/KB/Memory Based Deductive Inference
Deductive Inference, Dynamic CG and Synergy
Ontology/KB/Memory Based Abductive Inference
Ontology/KB/Memory Based Analogical Inference
Memory/KB/Memory Based Inference GUI
Ontology/KB/Memory Based Inferences API
An Ontology in Amine is a graph where nodes corresponds to different kinds of Conceptual Structures (CS): Concept Type Definition, Relation Type Definition, Canon, Individual description and Situation (and also Context and Metaphor). Amine 5 provides also the possibility to define and use KnowledgeBase (KB), separate from an ontology. Since Amine 5, we introduced a new type of CS: CSRule. An ontology, as well as a KB, can contain rules of the form CG_Antecedent => CG_Consequence. With the integration of CSRules in an ontology/KB/memory, Amine becomes involved with the very important topic of Ontology/KB/Memory Based Inferences, i.e. inferences strategies (like Induction, Deduction, Abduction, Analogy) are defined and implemented according to the structure and operations defined on the (agent/system) ontology/KB/memory: during the integration of a new information in the ontology/KB/memory, some CSRules will be "activated"; activation of a CSRule corresponds to an elementary inference step. For instance, in the case of deductive inference, the consequence of the activated CSRule will be deduced if the antecedent is verified (it subsumes the new description). Different actions can be taken from that "computation/inference step": a) the consequence can be integrated as a new information to integrate, b) the consequence can be joined to the current information (that is being integrated) leading to a reformulation/transformation/transmutation of this information.
The main point here is that inferences strategies are defined and implemented in terms and according to the ontology/KB/memory that contains the knowledge required for the inference. The inference steps will be triggered by and during the integration of a new information in the ontology/KB/memory.
We are starting to explore this very important topic: Ontology/KB/Memory Based Inferences. The next section introduces the basic steps in Ontology/KB/Memory Based Inferences as defined and implemented currently in Amine. Then, we introduce the three inference modes: Ontology/KB/Memory Based Deductive Inference, Ontology/KB/Memory Based Abductive Inference and Ontology/KB/Memory Based Analogical Inference.
Ontology/KB/Memory Based Inferences
The following treatment is common to Ontology/KB/MemoryBased Deductive Inference and Ontology/KB/MemoryBased Abductive Inference. The input to the Ontology/KB/Memory based inference is a proposition/situation (let us call it newDescr). The output of the inference process is an updated description of the input. The inference process attempts to compute what can be infered about its input, what transformation or transmutation can be applied to the input, given its ontology/KB/memory. The inference process is an iterative call to an elementary inference step. An elementary step inference consists first in asking for the position, in the ontology/KB/memory, of the given new description newDescr. Thus, the one step inference operation performs first a simulated classification to locate the most specific CSRule that can be applied on the specified newDescr. If such a CSRule is located, it will be applied depending on the nature of the inference strategy.
Note that the inference process memorizes the CSRules that have been activated so that each CSRule is activated only once, to avoid cyclic activation of the same CSRule.
Ontology/KB/Memory Based Deductive Inference
In the case of deductive inference, the located CSRule applies to the newDescr as follows: if newDescr is equal or more specific than the antecedent of the located CSRule, this latter is activated; its consequence is joined to the new description newDescr. The result of this maximalJoin will be considered as the new value of newDescr and the inference process will continue with the updated newDescr.
Example
To illustrate ontology/KB/memory based deductive inference, let us consider a simple example. Figure 1 shows the state of the ontology "CatMouse3.xml". It contains two rules described in Figure 2.
Figure 1: The Ontology
Figure 2 provides the CG formulation of the followinf two rules:
First rule: if a cat eat then the cat is strong.
Second rule: if the cat is strong then the color of the cat is black.
As illustrated by the CG formulation of the two rules (Figure 2), we use variables instead of coreferents to denote coreferences between concepts that belong to the antecedent and consequent of a rule.
Figure 2: Description of two rules in the ontology
To initiate Deduction inference, we select button "Deduction" (Figure 1). Then the system displays the "Memory Based Inferences Frame" to edit the situation that will initiate the deduction process (Figure 3). The button "Deduction" will initiate the deduction process. It is similar to ask: What can be deduced from the proposition "a Cat eats a Mouse and the known rules in the ontology" ? Note that this proposition (a Cat eats a Mouse) is not really integrated (and added) to the ontology. The deductive process looks for the most specific rule that its antecedent subsumes the specified proposition.
Figure 3: Asking: What can be deduced from the proposition "a Cat eats a Mouse" ?
Figure 4 shows the result of the deduction process. As it can be noted from the frame that reports the steps of the deduction process (the frame titled "Result of Memory Based Deductive Inference" in Figure 4), the deduction process is composed, in this example, of two successive deduction steps:
The deduction process simulates the integration of the specified description in order to locate the most specific CSRule which its antecedent subsumes the specified description. In fact, several CSRules can be found that satisfy this constraint, but in our present definition, only one is considered.
The consequence of the CSRule is deduced and joined to the specified description. The result of this first deduction step is shown in the frame "Result of Memory Based Deductive Inference".
The transformed description becomes the new description to integrate (GoTo step 1). It is important to note however the problem of an infinite loop if the same CSRule is selected again and again. To avoid this problem, the inference process memorizes all the CSRules that were activated. Using this memory, the inference process activates a CSRule only once. That is why in our example the second deduction operation ignores the previous activated CSRule and locates/finds the second CSRule (see "Result of Memory Based Deductive Inference" in Figure 4).
Figure 4: Result of deductive inference
Deductive Inference, Dynamic CG and Synergy
Since Amine 6, the antecedent of a rule (stored in an Ontology or a KB) can be an "activable CG", i.e. a CG with concepts that have states different from "steady" state. The impact of this possibility on "Ontology/KB/Memory based deductive inference" can be described as follows: If the initial proposition/situation D is compared to the antecedent A of a rule, and if D is more specific than A, and if A is an activable CG, then the states of the concepts in A are transfered to D, and D is executed. After the execution, any concept or relation that has been added to D (due to the maximal join of situations during the execution of D) is removed.
To summarize, a rule with an activable antecedent has the following "procedural" meaning: if a description D is more specific than the antecedent of the rule, then make D activable (by transfer of concepts states) and execute D, and then deduce the consequence of the rule.
The following example will illustrate this new feature of Ontology/KB/Memory Based Deductive Inference.
Example:
This example makes use of the ontology stored in "aminePlatform\samples\ontology\CatMouse5.xml". And since Synergy categories are used in this ontology (see below), user should load first "Synergy Ontology". To do that, user should proceed as follows:
Open Dynamic Ontology/KB GUI
Select from the menu "Parameters" the action/option "Load First Synergy Ontology"
Open the ontology "CatMouse5.xml"
Then you can select the button "Expand All" to see all the content of the ontology. Part of it is shown in Figure 5. This Figure shows also the content of the rule that is indexed under the concept type "Cat", and the content of the situation that is indexed under the concept "Age". Note that the antecedent of the rule has the concept [Age] at trigger state. So, this is an activable antecedent. Note also that this antecedent doesn't specify how to compute the value/descriptor of the concept [Age]. The information "How to compute Age" is represented and stored in the situation that is indexed under the concept type "Age". So, this updated version of Deductive Inference mechanism will make use not only of Synergy (to execute the activable CG) but also of Dynamic Programming as it is incorporated in Synergy. This means that Synergy will search for itself, in its current ontology/KB, how to compute Age, and will make use of such a knowledge to compute the descriptor/value of the concept [Age] in the antecedent of the rule. To compute Age, the specified situation calls a specific Java method (diffDate) that is defined in the class "CMethods". Thus, user can use Synergy primitives, or types defined in Synergy, or Java methods from Java classes, or Java methods from classes defined by the user.
Figure 5: The Ontology used in our example
Since we are concerned by "Deductive Inference", then we have to select/press the button "Deduction". Following this selection, Amine provides the "Memory-Based Inferences Frame". Figure 6 shows this frame and shows also the description to consider. So, by selecting the button "DeductiveInference", the user is asking the question: "What can be deduced for/about the specified description ?"
Figure 6: The description to consider
Figure 7 shows the result of the deductive inference. Note that the value of Age has been computed and is now provided in the consequence.
Figure 7: The result of the Inference
Ontology/KB/Memory Abductive Inference
In the case of abductive inference, the located CSRule applies to the newDescr as follows: if newDescr is equal or more specific than the consequence of the located CSRule, this latter is activated; its antecedent is joined to the new description newDescr. The result of this maximalJoin will be considered as the new value of newDescr and the inference process will continue with the updated newDescr.
Example
We consider the ontology of the previous example (i.e. ontology "CatMouse3.xml", see Figure 1). Figure 5 shows a reformulation of the two rules that are indexed under types Strong and Cat.
Figure 5: modification of the two rules in the ontology
Figure 6 shows the selection of the option "Abduction" (by a press on the button "Abduction"), followed by a display of the "Memory Based Inferences Frame". The request that is formulated in this frame is similar to ask: "What can be infered by abduction from the proposition "strong Cat" ? Button "Abduction" is then pressed to initiate the abduction process.
Figure 6: Asking: "What can be infered by abduction from the proposition "strong Cat" ?
The result is reported in Figure 7.
Figure 7: Result of abductive inference
Ontology/KB/Memory Based Analogical Inference
In the case of analogical inference, the treatment is somewhat different. The first step is the integration process of the newDescr: types that are specified in newDescr are considered as pertinent types. The integration process will attempt to locate a CSRule that can enable analogical inference on newDescr. Such a CSRule is located if newDescr can be projected on the antecedent of the CSRule. It is important to note that the projection operation is not the subsumption operation (that checks if the first CG is more general than the second CG). Projection operation is a matching operation that attempts to build a mapping between the first and the second CG (mapping between concepts in the first and the second CG), based on the constraint that the structural/relational network of the first CG is found/contained in the second CG. This constraint constitutes the similarity criteria between the two CGs that allows for the construction of an analogy (and especially the mapping part) between the two CGs. In other words, a CSRule can be used to perform analogical inference if a projection/mapping is possible between the newDescr and the antecedent of the CSRule (i.e. the two CG share the same structural/relational network). Of course, this is just an heuristic, among others, that enables the construction of a context for analogical inference.
Once a CSRule is located as a candidate for analogical inference, its consequence is adapted, taking into account the mapping, established by the projection operation, between newDescr and the antecedent of the CSRule: if a concept Cc in the consequence is in coreference with a concept Ca in the antecedent, and a mapping exists between Ca and a concept Ce in newDescr, then Cc is replaced by Ce. The canonicity of the consequence is checked after this adaptation: any relation that is not canonic (i.e. its use in the CG is not conform to its canon) is removed from the consequence. And if a concept is no more connected to the other concepts of the consequence, it is removed too.
For an adequate performance of analogical inference, it is important to specify coreferences. Now, please note that coreferences between concepts that belong to the antecedent and to the consequent of a rule are specified by variables, not by defined labels (like *x) and bound labels (like ?x). Examples below illustrate this important point.
Example # 1:
Figure 8 shows part of the ontology ("CatMouse3.xml") used in this example.
Figure 8: part of the ontology for the analogical inference example
Figure 9 shows the content of a CSRule that will be used in an analogical inference. The rule states:
If a Human h (want to) Cut an Apple a, then he/she has to cut the apple a with a Knife.
Please, note the use of variables instead of usual coreferences (with defined and bound labels).
Figure 9: Content of the rule that will be used by analogical inference
Figure 10 shows the proposition that will be integrated in the ontology and that will initiate an analogical inference. The proposition states that: A woman (want to) cut an Orange
Figure 10: The new description
Figure 11 shows the result of the analogical inference: since the newDescr can be projected on the antecedent of the located CSRule and a mapping has been created between the two CG, than the CSRule can be used to initiate analogical inference, i.e. the consequence can be adapted and infered: the woman (could) use the knife to cut the orange.
Figure 11: The result of the analogical inference step
Example #2
This second example illustrates the case where the consequence is not a simple CG, but a compound CG; the adaptation of the consequence should be applied to all the embeeded CGs.
The CSRule that will be used in the analogical inference is the following (see Figure 12 for the CG formulation):
If a Man m1 wants to possess a Bicycle b which is owned by another Man m2, then
the Man m1 must offer money to the Man m2, and then he must persuade him that his Bicycle b is bad.
This rule is indexed under the type "Possess".
Figure 12: The rule that will be used by the analogical inference step
Figure 13 shows the proposition to integrate, that will initiate the analogical inference:
a Country c1 wants to possess Tomatos owned by another Country c2.
Figure 13: The new description to consider
Figure 14 shows the result of the analogical inference: it was infered that the country c1 must offer money to country c2, and country c1 must persuade country c2 that its Tomatos is Bad.
Figure 14: The result of the analogical inference step
Memory/KB/Memory Based Inference GUI
See Memory/KB/Memory Based Inference GUI for a brief presentation of this GUI. But examples in this document illustrate the use of this GUI.
Ontology/KB/Memory Based Inferences API
Constructors
public MemoryDeductiveInference(Ontology ontology, Lexicon lexicon) throws DynamicOntologyException;
public MemoryAbductiveInference(Ontology ontology, Lexicon lexicon) throws DynamicOntologyException;
public MemoryAnalogicalInference(Ontology ontology, Lexicon lexicon) throws DynamicOntologyException;
The three modes of inferences; Memory Deductive Inference, Memory Abductive Inference and Memory Analogical Inference, are defined as classes (MemoryDeductiveInference, MemoryAbductiveInference, MemoryAnalogicalInference) that are specializations of the class MemoryBasedInferences. This class provides the following methods which are inherited by its three subclasses:
public JTextArea getTextArea();
public void setTextArea(JTextArea txtArea);
public CG oneInferenceStep(CG newDescr) throws Exception;
public CG strictInferenceChain(CG newDescr) throws Exception;
MemoryBasedInferences has an attribute (a JTextArea) that will contain the result of the memory-based inference. The methods getTextArea() and setTextArea() concern this attribute.
The method oneInferenceStep(CG newDescr) performs one inference step; activation of one CSRule. The outcome of the method corresponds to the result of the "one inference step".
The method strictInferenceChain(CG newDescr) performs a chain of inferences; it corresponds to an iterative call of oneInferenceStep().
Ontology/KB/Memory Based Inferences is a very promizing and exciting research topic: much work is needed to study more deeply this contextual perspective of inference strategies. What is clear however from this first investigation is the following Equation (Inference strategies should be defined as operations and processes that apply on ontology/KB/memory):
Reasoning/Inferences = Ontology/KB/Memory Based Operations and Processes