Jess,
Not sure if this is known, have not seen much on the internal workings
of modify. I'm concerned about this because it looks like modifying a
fact sometimes requires the equivalent of:
For each slot modified
{
Retract the fact
Set the slot
Assert the fact
}
Although in 6.1p7 it
Fun one with Accumulate:
(deftemplate encounter
(slot date)
(slot code))
(reset)
(assert (encounter (date 2005-10-31) (code 440)))
(assert (encounter (date 2005-10-31) (code 440)))
(assert (encounter (date 2005-10-31) (code 777.1)))
(assert (encounter (date 2005-10-31) (code 468.1)))
(assert
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)
I think Roger Studner wrote:
(defrule count-icd9-codes
?c - (accumulate (bind ?count 0) ;; initializer
(bind ?count (+ ?count 1)) ;; action
?count ;; result
(encounter (code ?c : (eq ?c 440)))
)
...
This (and anything in the accumlates match
I think Jon Weygandt wrote:
it looks like modifying a fact sometimes requires the equivalent of:
For each slot modified
{
Retract the fact
Set the slot
Assert the fact
}
Yes, more or less. Special versions of retract and assert can be
used to cut a few corners in this
I think Jon Weygandt wrote:
Jess,
That's her picture on the cover of Jess in Action :)
(TRANS_STATE ?trans_state SI | MI | EI)
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
Thanks so much!
I wanted to say.. that what made me think something was 'amiss'.. is that
the accumulate example from the web page:
(deftemplate employee
(slot salary))
(deffacts employee-facts
(employee (salary 1007700))
(employee (salary 1002347700))
(employee (salary 107712000))
)
(watch all)
Ernest,
Thanks.
The translation is none to intuitive, but the ppdefrule helps.
It also shows the problem with the original rule as well.
Jon
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 08, 2005 12:28 PM
To: jess-users@sandia.gov
I think Roger Studner wrote:
(deftemplate employee
(slot salary))
(deffacts employee-facts
(employee (salary 1007700))
(employee (salary 1002347700))
(employee (salary 107712000))
)
(watch all)
(reset)
(defrule count-highly-paid-employees
?c - (accumulate (bind ?count 0) ;;
Title: RE: JESS: Behavior change from 6.1p7 to 7.0b3 with modify function
One of my programs uses beans with derived properties. Thus, it is common in this program that multiple slots are modified together.
Also, I would argue for atomic multiple-slot modification for the sake of safety.
10 matches
Mail list logo