Can anyone explain to me why this does not work? Why can't I use 

(deffacts initial-facts 
        "Facts to trigger a few appropriate salient initialization rules."
        (assert-request-parameters))

(defrule assert-request-parameters-rule
        "Assert stored data one time."
        (declare (salience 100))
        ?x <- (assert-request-parameters)
        =>
        (foreach ?key (((fetch request-parameter-map) keySet) iterator)
                (build str-cat "(assert (" ?key " " ((fetch 
request-parameter-map) get ?key) "))"))
                ; why not (assert (?key ((fetch request-parameter-map) get 
?key))))
        (retract ?x))
        
(bind ?map (new java.util.HashMap))
(?map put one 1)
(?map put two 2)
(?map put three 3)
(store request-parameter-map ?map)
(reset)
(facts)
(run)
(facts)

Jess, the Rule Engine for the Java Platform
Copyright (C) 2008 Sandia Corporation
Jess Version 7.1p2 11/5/2008

This copy of Jess will expire in 207 day(s).
f-0   (MAIN::initial-fact)
f-1   (MAIN::assert-request-parameters)
For a total of 2 facts in module MAIN.

f-0   (MAIN::initial-fact)
For a total of 1 facts in module MAIN.

Reply via email to