On Apr 10, 2007, at 9:19 AM, Michael Smith wrote:

I've taken a stab at a re-write, but no guarantees. A few things that might help:
...

What follows *might* possibly be an accurate translation -- but it was a pretty long expression -- so no guarantees :).

(defrule Jim_Rule "Jim Rule Comment"
  (BatchInboundTransactions (inbound_id ?inId))
  (BatchInboundTransactions (facilitycode ?facilitycode))
  (BatchInboundTransactions (amount ?amount))
  (BatchInboundTransactions (rvu ?rvu))
  (BatchInboundTransactions (quantity ?quantity))
  (BatchInboundTransactions (costctr ?costctr))
  (BatchInboundTransactions (servicecode ?servicecode))
  (test
    (and
     (neq ?facilitycode S)
...


Thanks, Michael, for your good explanation. Another thing I want to add for Jim is that each "BatchInboundTransactions" line on the rule's left hand side matches a single BatchInboundTransactions object independently; in other words, if you've got ten such objects, then this rule matches all of them in 10 to the sixth power (one million) different combinations, and the logic applies to values extracted from any combination of those objects. I'm almost certain this is not what you intend; I'm pretty sure you want all the values to come from just one object. To do this, you'd have just one "BatchInboundTransactions" line with all the slot qualifiers in it; i.e.,

(defrule Jim_Rule "Jim Rule Comment"
  (BatchInboundTransactions (inbound_id ?inId)
                            (facilitycode ?facilitycode)
                            (amount ?amount)
                            (rvu ?rvu)
                            (quantity ?quantity)
                            (costctr ?costctr)
                            (servicecode ?servicecode))

If you are guaranteed to only ever have a single BatchInboundTransactions object, then what you've written will have the same effect -- it will just be unnecessarily inefficient.

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550                 http://www.jessrules.com

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