This comes up about twice a month on the mailing list. In currently
released versions of Jess, queries don't trigger backward chaining. In
the next release, they will. To turn this on for yourself, look in
jess/MiscFunctions.java, at about line 680 (Jess 6.0b2):
// Allow backwards chaining to occur
// EJFH FIXME Is this appropriate?
// engine.run(10);
The answer to the question is yes, it's OK. Uncomment that line of
code (the run() call,) recompile, and queries will trigger backward
chaining, so your intutitive approach below will work.
I think Mark Nahabedian wrote:
>
> How can I determine if a fact is present or can be concluded via
> backward chaining? Other expert systems I've used have an operator,
> typically named ASK, which will do this.
>
> Suppose I have a two argument predicate OPPOSITE-SIDE which is
> symetric, such that if (OPPOSITE-SIDE a b) is true then (OPPOSITE-SIDE
> b a) is also true:
>
> (do-backward-chaining opposite-side)
>
> (defrule opposite-side-symetric
> (need-opposite-side ?side1 ?side2)
> (opposite-side ?side2 ?side1)
> =>
> (assert (opposite-side ?side1 ?side2)))
>
> And I now make an assertion about two opposites:
>
> (assert (opposite-side side-z side-y))
>
> How can I test to make sure that
>
> (opposite-side side-y side-z)
>
> is true?
>
>
> I tried using a query
>
> (defquery opposite-side
> (declare (variables ?x ?y))
> (opposite-side ?x ?y))
>
> (bind ?e (run-query opposite-side side-y side-z))
>
> (while (?e hasMoreElements)
> (printout t (call ?e nextElement) crlf))
>
> but that didn't give me anything useful. It just printed FALSE.
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------