Hi again, Will it ever be possible to assign unbound variables to the slots of Jess facts?
I made some sort of constraint solver for a particular domain in Jess, that uses backward chaining to solve the constraints the user enters at a command prompt, a bit like Prolog does. The purpose is to let Jess determine all facts that match the given constraints, by starting a backward chaining process that makes extensive use of forward chaining rules on different levels. It is not possible to solve constraints like: (foo (id ?)) or (foo (id ~~2)), if backward chaining is done for foo. In both cases, a fact (need- foo (id nil)) is asserted, which binds the id slot. The fact will only patternmatch once, possibly for a literal constraint that points to the nil value for the id slot, or for a variable constraint, which will bind it to the nil value. When the user enters (foo (id ~2)) I would like Jess to assert a fact (need-foo (id ~2)), where the id-slot is unbound, so it will patternmatch a seperate need-foo fact for every faa fact, except when that faa fact has id value 2: (defrule sample (faa (id ?id)) (need-foo (id ?id)) =>) The solution I use now first binds the variables by using regular patterns, for which no backward chaining is done. For example, if all faa facts are present in working memory, the constraint (faa (id ? id&~2)) (foo (?id)) will assert need-foo facts for every id for which a faa fact exists, except for the faa fact with id 2, which will result in the desired behaviour for the sample rule. I am sure the values of the slots of facts(not patterns) have to be bound in the current version of Jess, but I was just wondering that this will ever change, or at least, was ever considered? Regards, Steffen. -------------------------------------------------------------------- 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] --------------------------------------------------------------------