I think Judson, Ross wrote: > I've spent some time looking at the backwards chaining facility, trying > to match it up with my requirements. I have a few observations, to do > with the lifecycle of need-XXX facts. > > When you declare a deftemplate to be backward-chaining enabled, rules > are rewritten to produce need-XXX facts when the desired form of the > deftemplate is not available. > > 1. How long should/do the need-XXX facts exist?
Originally, Jess would retract them as soon as the rule that satisfied them fired. This turned out to cause problems, as their retraction would trigger their reassertion, causing the rules to fire again (the assertion of need-X facts is limited by a (not (need-X)) clause, so letting the facts continue to exists prevents redundant activity. > 2. How do they react to changes in the facts that caused them to be > asserted? There's currently no relationship there. > > Right now, upon assertion of a fact that can result in backwards > chaining, the need-XXX fact is generated. That fact appears to be > permanent...if no rule can generate the necessary fact, the need-XXX > fact stays. If the base assertion that triggered the need-XXX is > changed, the need-XXX is not retracted. > > In addition, once the need-XXX is satisfied, it is not removed. It is > easy to write a retract that will get rid of the need-XXX once you > satisfy it, but it is harder to remove the spurious ones whose base > condition has changed. > > Something like the support for logical may be necessary, where the > need-XXX is made to be dependent on the facts that produced it. That's a spectacular idea. Backward chaining predates "logical," so logical wasn't available to use in backward chaining's original implementation. But it could potentially be reworked to include it. This is a great idea. > > Which leads to the next question -- what is the best practice for > handling large numbers of varying queries? The top level of my RETE > graph is disturbingly wide, and mostly occupied by defquery stuff. I > wish there was another mechanism for indexing and accessing facts! Not sure what you're saying. Defqueries -are- a way of indexing facts and retrieving them efficiently, but I'm not sure why you think having many of them is bad. You can always call Rete.listFacts() and do a linear search yourself. --------------------------------------------------------- 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] --------------------------------------------------------------------
