I think Douglas Pearson wrote:
>  
> For example if I had:
>  
> (defrule simple-rule
>    (child (id ?x) (name ?name))
>    (parent (id ?y) (child ?x))
>    =>
>    (printout t "Child " ?x " name " ?name crlf)
> )
> 
> and I know fact-3 and fact-7 were matched...how can I tell
> (programmatically) which fact matched which condition?


Well, the facts in a token are in the same order as the patterns they
matched. There's no way to explicitly ask for the jess.Pattern that a
given fact in a jess.Token matched, although you could probably back
it out by getting the jess.Defrule of interest and calling
getConditionalElements() to get the root of the (potentially
tree-structured) LHS patterns. This is not well-documented, and for
good reason: you'll find that the structure changes quite a bit as
Jess evolves from version to version.

>  
> I'd also really like to get partial match information as well...not just
> when the rule fired and I'm less clear on how to even get started with that
> since the rule won't be in the agenda.

There's no public API for this, but if you've got a Jess license, you
can poke around in the source. See the implementation of the (matches)
command (which displays partial matches.) The key thing it does is
call getNodes() on the given Defrule object, which returns a List of
jess.Node objects. These are the Rete network nodes. You can root
through this list and find the Node2 objects (the join nodes) and then
look at their alpha memories.


---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

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