I can't think of any non-awkward way to do this in the current
implementation, but you've raised an excellent point: this should be
doable somehow. I will have to think about how this might be
implemented. Thanks for the feedback.
I think Navabi, Dariush wrote:
> Hi all,
> The rule program below returns only one of the three possible results for
> the "(statement1 ?name)" goal.
> Is it possible to structure rules such that the program returns all possible
> results for a goal?
>
> Thanks in advance,
> Dariush Navabi
>
> Rule Program:
>
> (deftemplate statement1 (slot name))
> (deftemplate statement2 (slot name))
> (deftemplate statement3 (slot name))
> (deftemplate statement4 (slot name))
>
>
> (deffacts initfacts
> (statement3 (name ROB))
> (statement4 (name JOE))
> (statement3 (name TOM))
> )
>
> (do-backward-chaining statement1)
> (do-backward-chaining statement2)
>
> (defrule printSt1Name
> (statement1 (name ?name))
> =>
> (printout t "THE NAME IS: " ?name crlf)
> )
>
> (defrule do-getSt1Name1
> (need-statement1 (name ?))
> (statement4 (name ?name))
> =>
> (assert (statement1 (name ?name)))
> (printout t "statement4 name is: " ?name crlf)
> )
>
> ; An attempt to make backward chaining continue after the first
> ; result. It did not work.
> ;
> ;(defrule tmp
> ; (explicit (statement1 (name ROB)))
> ; ;=>
> ; (assert (need-statement1 (name nil)))
> ; )
>
> (defrule do-getSt1Name2
> (need-statement1 (name ?))
> (statement2 (name ?name))
> =>
> (assert (statement1 (name ?name)))
> (printout t "statement2 name is: " ?name crlf)
> )
>
> (defrule do-getst2Name
> (need-statement2 (name ?))
> (statement3 (name ?name))
> =>
> (assert (statement2 (name ?name)))
> (printout t "statement3 name is: " ?name crlf)
> )
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------