Back to a month-old topic, herewith some more information. Back then I
asked
1) whether others have suggestions for implementing backtracking in
Jess and
2) whether it would be appropriate to make Activation.setInactive()
public.
Thanks again for your replies so far. Anyone who reads all
Eric,
here is the rule that will work:
(defrule items-to-buy
?ItemFound - (SomethingIWant (Name
?ItemName)
(Price ?ItemPrice)
(Priority ?ItemPriority1)
(Selected false ) )
(not (SomethingIWant (Selected false) (Priority ?p:( ?p
?ItemPriority1
=
(printout t Found: ?ItemName
,
Thanks, but that only matches
on the single set of facts with the lowest priority. I want to get all of the
facts, I just want them to be given to the rule in order of priority. For
example, given the following set of facts:
(assert
(SomethingIWant
(Name
Hmm, I don't think so. Copy\paste! :) I should have mentioned it
before, I'm using the publicly available version 6.1p4 that I downloaded
based on instructions in the book. Would that matter? I'm still waiting for
my company to fill out the licensing forms to get the latest version.
Aha, said the blind man! :) I really did copy\paste Dusan's rule. But, I
pasted just the rule into my program. And in my program I was asserting the
facts before defining the rule and apparently that makes quite a difference.
Now, let me see if I can grok why that is. This was just a simplified