JESS: multislot accumulate behavior
"Donald Winston" <[email protected]>
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <2410_1290429102_oAMCVb2A004277_EAFB6DDB-45DB-428E-B1FD-C2FFCAF9D92A@yahoo.com> |
(defrule VALIDATE:dataset-variables
(page "edit-dataset.xslt")
?dataset <- (dataset (variables $?))
?errors <- (accumulate (bind ?list (new java.util.ArrayList))
(?list add ?var)
?list
(dataset (variables $? ?var&:
(not (regexp "^[a-zA-Z_][a-zA-Z0-9_\\.]*$" ?var)) $?)))
=>
(printout t "errors = " (?errors toString) crlf)
(modify ?dataset
; TODO: set variableErrors for each variable in ?errors"
(has-errors TRUE)))
Rules whose RHS modify facts referenced in the LHS gets fired twice which is normally not a problem but when I use accumulate it returns an empty list for the second firing. I had to declare slot-specific = TRUE in the fact's deftemplate that's being referenced to get it to work properly. Why doesn't it return the same result again?
Donald Paul Winston
[email protected]