Jess,

An area of somewhat unclear documentation about how "Basic Patterns" are
interpreted, and I want to be sure before passing information on to our
customers. I have the following rule, pay attention to the TRANS_STATE
slot:

(defrule FC
  ?cast <-
  (FC
   (SQL_OPERATION "UPDATE" | "INSERT")
   (TRANS_STATE ?trans_state & "SI" | "MI" | "EI")
   (TRANS_STATE_last ~?trans_state)
   (CTRLJOB_ID ?id)
   )
  =>
  (printout t "FC: " ?id crlf)
  )

My procedural view would be the pattern is evaluated as:
(TRANS_STATE (?trans_state & "SI") | "MI" | "EI")
And if the match for "SI" fails, not sure what ?trans_state would be.

However from testing, it looks like the binding is a byproduct of the
first test and the statement is really evaluated like:
(TRANS_STATE ?trans_state & ("SI" | "MI" | "EI"))
But to write this results in a compile time error.


BTW the original customer written rule has the TRANS_STATE slot twice in
the pattern match. This fails as it seems the binding to ?trans_state
isn't done, and thus the test for ~?trans_state always returns true.

(defrule Orig
  ?cast <-
  (FC
   (SQL_OPERATION "UPDATE" | "INSERT")
   (TRANS_STATE "SI" | "MI" | "EI")
   (TRANS_STATE ?trans_state)
   (TRANS_STATE_last ~?trans_state)
   (CTRLJOB_ID ?id)
   )
  =>
  (printout t "Orig: " ?id crlf)
  )

Jon


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