I think Judson, Ross wrote: > We often want to write rules that fire when we have a certain number of > facts that meet some criteria. If I am trying to write a rule that > fires on a certain cardinality, it isn't very straightforward.
No, indeed. Sounds like a useful feature; I'm always open to ideas. > > We can write a rule that will try to keep a count of the number of facts > that meet a certain template. > By incrementing a defglobal as each one is asserted, yes. > We can write a rule that matches on a specific number (using > constraints). We write a number of these rules, one for each number we > are looking for. This works for small numbers. > > Jess supports the (count-query-results) function, which can be helpful > but can't really be used on the left side of a rule. Well, for now, this might be the key. You -can- use queries on the LHS of a rule, but you do need to know what you're doing. As long as you turn backward chaining off for that query, and as long as you think about the way in which the query will be triggered (i.e., by pattern-matching) you should be able to get away with it. > > Some variant on the logical support mechanism might be feasible here. > > So what is the best mechanism for counting facts that meet a pattern, > then using that count to drive rules? A count-matches conditional element of some kind might be a useful tool. --------------------------------------------------------- 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] --------------------------------------------------------------------
