Re: JESS: Asserting facts wiith object slots
Yes, it was a parentheses issue thanks! On Sat, 31 Dec 2005 07:02:24 -0800 (PST), ejfried wrote > I think erich.oliphant wrote: > [Charset iso-8859-1 unsupported, filtering to ASCII...] > > > > (defrule assert-a-temp > >=> > >(bind ?objRef (get-a-ref-to-java-class)) > >(assert (temp (x "val") (y ?objRef > > > > When I have (watch all) on, I see something like: > > ==> f-2 (MAIN::temp (x "val") (y nil)) > > ==> f-3 (MAIN::y > > > When I do a match on the 'temp' fact in other rules and try to bind > > to the 'y' slot value it's always nil. Is what I'm trying doing > > possible/legal ? > > I suspect that in simplifying your example for us, you fixed an > error. A misplaced parenthesis is causing the assert statement to > assert two facts, a "temp" fact and a "y" fact -- the "y" slot is > outside the "temp" fact's parentheses, like this: > > (assert (temp (x "val")) (y ?objRef)) > > You can clearly see two separate facts in the "watch" output. > > Perhaps interestingly, the JessDE editor would have issued a warning > for this assert statment, letting you know that the ordered template > "y" was not previously declared. > > - > Ernest Friedman-Hill > Advanced Software Research Phone: (925) 294-2154 > Sandia National LabsFAX: (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] > 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]
Re: JESS: Asserting facts wiith object slots
I think erich.oliphant wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > > (defrule assert-a-temp >=> >(bind ?objRef (get-a-ref-to-java-class)) >(assert (temp (x "val") (y ?objRef > > When I have (watch all) on, I see something like: > ==> f-2 (MAIN::temp (x "val") (y nil)) > ==> f-3 (MAIN::y > When I do a match on the 'temp' fact in other rules and try to bind > to the 'y' slot value it's always nil. Is what I'm trying doing > possible/legal ? I suspect that in simplifying your example for us, you fixed an error. A misplaced parenthesis is causing the assert statement to assert two facts, a "temp" fact and a "y" fact -- the "y" slot is outside the "temp" fact's parentheses, like this: (assert (temp (x "val")) (y ?objRef)) You can clearly see two separate facts in the "watch" output. Perhaps interestingly, the JessDE editor would have issued a warning for this assert statment, letting you know that the ordered template "y" was not previously declared. - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (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]
JESS: Asserting facts wiith object slots
Hi, I have the following situation: A deftemplate like this: ;; I use this class as a fact elsewhere (defclass java.Class java.Class nil) (deftemplate temp (slot x) (slot y (type OBJECT))) And rule like this (defrule assert-a-temp => (bind ?objRef (get-a-ref-to-java-class)) (assert (temp (x "val") (y ?objRef When I have (watch all) on, I see something like: ==> f-2 (MAIN::temp (x "val") (y nil)) ==> f-3 (MAIN::y