JESS: Can't use funcalls in backchained patterns?
"Henrique Lopes Cardoso" <[email protected]>
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I was trying to make a rule that fires a few seconds after a fact is
asserted. Here is my experiment:
(deftemplate time (slot when))
(do-backward-chaining time)
(defrule do-time
(need-time (when ?w))
=>
(schedule-time-alert ?w) )
(deftemplate k
(slot when (default-dynamic (call System currentTimeMillis))) )
(defrule r
(k (when ?w))
(time (when =(+ ?w 3000))) ; a time fact 3 seconds after k is expected
=>
(printout t "3 seconds after k!" crlf) )
Function schedule-time-alert is implemented in Java and is supposed to
add a fact at the indicated time.
While this approach looks pretty clean to me, it does not even compile.
I am getting a "Can't use funcalls in backchained patterns when", in
rule r. This does not seem to be documented (at least I did not find it).
There is a work arround described in
http://www.jessrules.com/jess/FAQ.shtml#Q9
That approach has been suggested in previous e-mail threads, I have noticed.
But while it seems to work, it is also much more CPU-intensive, as a
number of time events (idle facts in faq Q9) would be added for no reason.
Any thoughts?
Thanks.
Henrique
--------------------------------------------------------------------
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].
--------------------------------------------------------------------