Hello Pedro,

At 19:09 24-4-2002 +0100, you wrote:
>         I was wondering if there is any chance of getting the "reasons" 
> that made a
>rule to be fired. In other words, let's imagine that at the end of an
>inference the user wants to know "the why" of a certain conclusion,
>therefore I would like to know if there is a built-in automatic mechanism to
>fetch such information.
>
>         For instance,
>
>         (defrule xpto1 ""
>           (fact1 ?x)
>         =>
>         (assert (fact2 ?x))
>        )
>
>         (defrule xpto2 ""
>           (fact2 ?x)
>         =>
>         (assert (conclusion ?x))
>        )
>
>
>         When the inference ends, the user would like to have something 
> like this:
>
>         --> conclusion due to fact2
>         --> fact2 due to fact1

Take a look at the manual 2.8.2 about pattern bindings. My guess is, that 
this would help you out. You would get something like:

(defrule xpto2 ""
         ?f <- (fact2 ?x)
         =>
         (assert (conclusion ?x))
         (printout t "conclusion due to " ?f crlf)
)

Bye,
Sander



--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to