I think =?iso-8859-1?q?Moderator?= wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]

> 
> (list-of-names (names john ronnie mark pat meg cindi))
> (person (name Bob))
>
> (defrule matches-names 
> (list-of-names (names $? ?var1 $?)) 
> (person (name ?var1))
> => (printout t ?var1 crlf))
> 
> As per the given facts this rule wont fire.
>

Yes. Does this surprise you? The rule says basically to print the name
of each individual person whose name appears on the list, and Bob
doesn't appear on the list. Maybe this is just an example and you're
talking about the larger principle of debugging rules.

> What i am trying to do is find out all values of ?var1
> that were matched with in pattern (list-of-names) on
> the rule LHS. I want to access the values of ?var1
> from java so that i can then print the rule with
> variable values substituted in it which i think would
> make easier figuring out why this rule didnt fire.
> (hence had put the subject line as debugger for jess) 
> 

Well, Jess doesn't really give you that kind of access to the inner
workings of the pattern matcher. The "matches" command and the "view"
command are intended to help you figure this sort of thing out.

If you're interested in modifying Jess's internals to achieve this --
i.e, if this is a research project -- then basically the list you want
is the contents of the left (alpha) memory of the single join node
compiled from the above rule. The list will contain one jess.Token for
each permutation of the three variables, and each token will contain
one copy of the list-of-names fact. Each copy will have three entries
in the "names" multislot, corresponding to the three variables used to
match the contents of the slot. The second one will be the value of
?var1 for that permutation. All of these details as subject to change,
of course, since as I said, these are internal details, not publically
exposed.

But again, it would be easier to achieve this just by understanding
the rule language, and knowing that for this rule, ?var1 will match
each individual entry in the multislot.

---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        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