Hi,

I am trying to use a defquery in RHS of a rule, but for some some reason it returns an empty iterator only; I have tried the same code from console and not on RHS and it nicely returned an iterator with mathed single fact. What could be the reason?
Thanks,
Zoltan



(deftemplate Threshold (slot eventSource) (slot value))
(assert (Threshold (eventSource 'bankmodel.bankcenter.AccountManagementApplicationServer') (value 10.0)))
(assert (Threshold (eventSource 'bankmodel.branch.BackupRouter') (value 20.0)))
(assert (Threshold (eventSource 'bankmodel.branch.ClientWorkstation') (value 30.0)))
(assert (Threshold (eventSource 'bankmodel.bankcenter.Database') (value 40.0)))
(assert (Threshold (eventSource 'bankmodel.branch.FirewallServer') (value 50.0)))
(assert (Threshold (eventSource 'bankmodel.branch.LocalDocumentsFileServer') (value 60.0)))
(assert (Threshold (eventSource 'bankmodel.branch.LocalPrintServer') (value 70.0)))
(assert (Threshold (eventSource 'bankmodel.bankcenter.Router') (value 80.0)))
(assert (Threshold (eventSource 'bankmodel.branch.Router') (value 90.0)))
(defquery find-threshold (declare (variables ?x)) (Threshold (eventSource ?x)))
(defrule value-changes-object-state ?event <- (RawEvent (sourceId ?sourceId) (value ?value)) ?baseServiceObject <- (BaseServiceObject (id ?sourceId) (eventSource ?eventSource))
=> (printout t "-eventSource:" ?eventSource crlf)
(facts) (bind ?it (run-query find-threshold '?eventSource'))
(printout t "-hasnext:" (call ?it hasNext) crlf )
(bind ?token (call ?it next)) (bind ?fact (call ?token fact 1))
(bind ?thresholdValue (fact-slot-value ?fact value))
(modify ?baseServiceObject (value ?value) ) (retract ?event) )







-------------------------------------------------------------------- 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] --------------------------------------------------------------------



Reply via email to