Well, it's hard to tell precisely what you're seeing, because what you've shown is just part of a presumably much larger set of rules. But just looking at this one rule, and the given facts, the first version you show is incorrect, and the second version is perfect.
The only pattern that matches a "count" fact is a (not) pattern, and these should never lead to need-count facts. The ones that appear in your first message are both due to the bug I mentioned. In your second version, there are no need-count facts, and that's exactly what one would expect here. So based just on the one rule you're showing me, Jess is behaving correctly. I think Igor Gorbunov wrote: > On-the-fly testing! I try to beat your almost instant > reply, Ernest :) > > I've tried 6.1a4, and behavior has changed somewhat, > but now it's even worse - JESS does not create those > backward-chaining related facts (need-count). Attached > is the output, please compare it with the first > message. > > Thank you anyway! > > Igor > > P.S. My demo got postponed, so no urgency anymore. > > --- [EMAIL PROTECTED] wrote: > > Try 6.1a4 (just out). You're probably tickling a bug > > in 6.1a3 that was > > fixed in the new release. > > > > > > I think Igor Gorbunov wrote: > > > Hello Ernest and all, > > > > > > I'm unable to resolve my problem with (not) CE, > > and I > > > really need this functionality ASAP, so I would > > > appreciate any advice you could provide. Here's > > the > > > situation: > > > > > > I use backward-chaining to assert (count) facts to > > the > > > engine while it runs. Rules, which require (count) > > > facts to be calculated and asserted, may have > > > different patterns. One example of such a pattern > > > would be (count 0). Unfortunately, logic which > > > calculates and asserts (count) facts does not > > assert > > > any fact if the count is <1. > > > > > > So I need to modify my rules so, that in case > > (count > > > 0) is required by rule pattern, I also use > > "absence of > > > (count) fact" criteria as a part of rule LHS: > > > > > > (defrule myrule > > > (or (not (count ?)) ((count ?X) (test (eq ?X > > 0)))) > > > => > > > ... > > > > > > Right? > > > > > > Unfortunately, this (not (count ?)) kind of > > pattern > > > does not work for me. Here's real debug > > information, > > > so you can see what actually happens: > > > > > > <attached file> > > > > > > As you can see, there is two matches even though I > > > expected just one, for "john.smith". On the other > > > hand, if I remove (not) CE and use just (count ?) > > > pattern, it does match just one person: > > > "igor.gorbunov". > > > > > > Could you tell me why (not) doesn't work as I > > expect? > > > > > > Thank you very much, > > > Igor > > > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Yahoo! Finance - Get real-time stock quotes > > > http://finance.yahoo.com > > Content-Description: jesshelp.txt > > > > > (defrule rule_name_IDS_58_42 ?F_33<-(USER_TEMPLATE > > (USER_GENDER ?GENDER) (USER_FIRSTNAME ?FIRSTNAME) > > (USER_ID ?USERID) (USER_DOB ?DOB) (USER_ZIPCODE > > ?ZIPCODE) (USER_SUBSCRIPTIONS $?U_S) (USER_ETHNICITY > > ?ETHNICITY) (LOCATION_ID ?LOCATION) (DEPENDENT_FLAG > > ?DEPENDENT_FLAG) (USER_ACTIVE_STATUS ?ACTIVE_FLAG) ) > > (test (member$ 58 $?U_S)) > > > (test (and (neq ?GENDER "sfdhj" ) (eq ?GENDER > > "M" ) ) ) > > > (not (count (userID ?USERID) (messageID 42) > > (since "08/08/1990") (till "(current_date)") (count > > ?))) > > > => (assert (MessageMatch ?USERID 42)) ) > > > > > > ***(facts) before: > > > DUMPING FACTS: > > > f-0 (MAIN::initial-fact) > > > f-1 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "Jane") (USER_LASTNAME "Smith") > > (USER_GENDER "F") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "22554") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 31 58)) > > > f-2 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "Priya") (USER_LASTNAME "Chandra") > > (USER_GENDER "F") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "20102") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 49 58)) > > > f-3 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "John") (USER_LASTNAME "Smith") > > (USER_GENDER "M") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "22767") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 58)) > > > f-4 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "Igor") (USER_LASTNAME "Gorbunov") > > (USER_GENDER "M") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "21122") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 38 58)) > > > f-5 (MAIN::need-count (class nil) (count nil) > > (messageID 42) (since "08/08/1990") (till > > "(current_date)") (userID > > "[EMAIL PROTECTED]") (OBJECT nil)) > > > f-6 (MAIN::need-count (class nil) (count nil) > > (messageID 42) (since "08/08/1990") (till > > "(current_date)") (userID > > "[EMAIL PROTECTED]") (OBJECT nil)) > > > For a total of 7 facts. > > > > > > ***RUN... > > > ***calculating and asserting count fact > > > > > > Dumping count fact... > > > UserID: [EMAIL PROTECTED] > > > MessageID: 42 > > > Count: 1 > > > Since: 08/08/1990 > > > Till: (current_date) > > > > > > ***(facts) after: > > > f-0 (MAIN::initial-fact) > > > f-1 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "Jane") (USER_LASTNAME "Smith") > > (USER_GENDER "F") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "22554") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 31 58)) > > > f-2 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "Priya") (USER_LASTNAME "Chandra") > > (USER_GENDER "F") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "20102") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 49 58)) > > > f-3 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "John") (USER_LASTNAME "Smith") > > (USER_GENDER "M") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "22767") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 58)) > > > f-4 (MAIN::USER_TEMPLATE (USER_ID > > "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) > > (USER_FIRSTNAME "Igor") (USER_LASTNAME "Gorbunov") > > (USER_GENDER "M") (USER_DOB > > <External-Address:java.sql.Timestamp>) (USER_SSN > > nil) (USER_ZIPCODE "21122") (USER_EMAIL > > "[EMAIL PROTECTED]") (USER_PHONE_NO nil) > > (USER_ETHNICITY nil) (PLAN_ID nil) (LOCATION_ID nil) > > (USER_CONSENT nil) (DEPENDENT_FLAG nil) > > (USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) > > (USER_SUBSCRIPTIONS 38 58)) > > > f-5 (MAIN::need-count (class nil) (count nil) > > (messageID 42) (since "08/08/1990") (till > > "(current_date)") (userID > > "[EMAIL PROTECTED]") (OBJECT nil)) > > > f-6 (MAIN::need-count (class nil) (count nil) > > (messageID 42) (since "08/08/1990") (till > > "(current_date)") (userID > > "[EMAIL PROTECTED]") (OBJECT nil)) > > > === message truncated === > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com Content-Description: jesshelp2.txt > (defrule rule_name_IDS_58_42 ?F_33<-(USER_TEMPLATE (USER_GENDER ?GENDER) >(USER_FIRSTNAME ?FIRSTNAME) (USER_ID ?USERID) (USER_DOB ?DOB) (USER_ZIPCODE ?ZIPCODE) >(USER_SUBSCRIPTIONS $?U_S) (USER_ETHNICITY ?ETHNICITY) (LOCATION_ID ?LOCATION) >(DEPENDENT_FLAG ?DEPENDENT_FLAG) (USER_ACTIVE_STATUS ?ACTIVE_FLAG) ) (test (member$ >58 $?U_S)) > (test (and (neq ?GENDER "sfdhj" ) (eq ?GENDER "M" ) ) );;---------- History >Patterns ---------- > (not (count (userID ?USERID) (messageID 42) (since "08/08/1990") (till >"(current_date)") (count ?))) > => (assert (MessageMatch ?USERID 42)) ) > > DUMPING FACTS: > f-0 (MAIN::initial-fact) > f-1 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) >(USER_FIRSTNAME "Jane") (USER_LASTNAME "Smith") (USER_GENDER "F") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "22554") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 31 58)) > f-2 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID >nil) (USER_FIRSTNAME "Priya") (USER_LASTNAME "Chandra") (USER_GENDER "F") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "20102") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 49 58)) > f-3 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) >(USER_FIRSTNAME "John") (USER_LASTNAME "Smith") (USER_GENDER "M") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "22767") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 58)) > f-4 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID >nil) (USER_FIRSTNAME "Igor") (USER_LASTNAME "Gorbunov") (USER_GENDER "M") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "21122") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 38 58)) > For a total of 5 facts. > > f-0 (MAIN::initial-fact) > f-1 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) >(USER_FIRSTNAME "Jane") (USER_LASTNAME "Smith") (USER_GENDER "F") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "22554") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 31 58)) > f-2 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID >nil) (USER_FIRSTNAME "Priya") (USER_LASTNAME "Chandra") (USER_GENDER "F") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "20102") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 49 58)) > f-3 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID nil) >(USER_FIRSTNAME "John") (USER_LASTNAME "Smith") (USER_GENDER "M") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "22767") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 58)) > f-4 (MAIN::USER_TEMPLATE (USER_ID "[EMAIL PROTECTED]") (JOB_CLASS_ID >nil) (USER_FIRSTNAME "Igor") (USER_LASTNAME "Gorbunov") (USER_GENDER "M") (USER_DOB ><External-Address:java.sql.Timestamp>) (USER_SSN nil) (USER_ZIPCODE "21122") >(USER_EMAIL "[EMAIL PROTECTED]") (USER_PHONE_NO nil) (USER_ETHNICITY nil) >(PLAN_ID nil) (LOCATION_ID nil) (USER_CONSENT nil) (DEPENDENT_FLAG nil) >(USER_ACTIVE_STATUS "0") (PROFILE_UPDATE_FLAG nil) (USER_SUBSCRIPTIONS 38 58)) > f-5 (MAIN::MessageMatch "[EMAIL PROTECTED]" 42) > f-6 (MAIN::MessageMatch "[EMAIL PROTECTED]" 42) > For a total of 7 facts. --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 Org. 8920, MS 9012 [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 (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
