Hello,
first of all, thank you for your answer. However your solution doesn’t solve our problem. Consider this hypothetical example:

One template (or object) called “animal” with two slots: “type”, and “has_wings”

Two rules:

          IF animal.type =”bird”

THEN print “The animal can fly!”

          IF animal.type = “dinosaur” AND  animal.has_wings = TRUE

THEN print “The animal can fly!”

We want to use backward chaining in order to ask the user the minimum number of values necessary to obtain the conclusion.

In the example, firstly we ask the user for the “type” value. If the user writes “bird” as animal type, then it’s not necessary to ask for the “has_wings” value, because only with the type as “bird” we know that “the animal can fly”. In the other case, if the user introduces “dinosaur” as animal type, then we should ask the user for the “has_wings” value. If the answer is TRUE, then the conclusion is “can fly”.

            So, you can see that we need to read and assert the values independently, than is, first to read and assert the “type” slot, and later, if it is necessary, to read and assert the “has_wings” slot.

            I hope this simple example could explain our problem in a better way. We have tested this example using different facts, that is, two templates with only one slot each template, and the backward chaining mechanism works in right way, because we assert the facts independently.  But using more than one slot per template (and, by extension, various member variables per Java object) the operation is different.

The possible solution you suggest would be to set or modify the slots values, but the problem is that if the fact exists, maybe with “nil” values in the slots, the backward chaining mechanism doesn’t works because the fact exists already.

Thanks for your suggestions!

Joaquin Cañadas

Reply via email to