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