clipspy

Programmatically modify a fact slot using ClipsPy

微笑、不失礼 提交于 2019-12-11 17:08:08
问题 How to modify a fact of a template in CLIPS using ClipsPy. I have tried the reassigning slot value and sending modify in clips.build routine, (see py_modify function below) which did not work. This is the .clp file ;; KB.clp (deftemplate t (slot s_1 (type SYMBOL))) (defrule main-intent (initial-fact) => (assert (t (s_1 v_1))) ) (defrule rule_1 ?p<-(t (s_1 ?v)) => (printout t"BEFORE"crlf) (py_pfact) (py_modify ?p) (printout t"AFTER"crlf) (py_pfact) ) This is the python file.. # run.py import