我改变了我的专家系统核心以使用命名模块。
现在,当我调用find-all-facts
函数时,它总是返回
"Unable to find deftemplate 'XXX'"
。
例如,我的查询看起来像:
(find-all-facts ((?f PlannerGoal )) TRUE)
PlannerGoal deftemplate位于PLANNING模块中。
我也尝试过这样做:
(find-all-facts ((?f PLANNING::PlannerGoal )) TRUE)
但没有变化。我发出(运行)命令后运行此函数。
好像我不明白什么?
谢谢!
最可能的解释是,您执行find-all-all-facts命令的当前模块不会导入PlannerGoal deftemplate。
CLIPS (6.31 4/1/19)
CLIPS> (defmodule PLANNING (export ?ALL))
CLIPS> (deftemplate PlannerGoal (slot id))
CLIPS> (defmodule MAIN (import PLANNING ?ALL))
CLIPS> (assert (PlannerGoal (id 1)))
<Fact-1>
CLIPS> (assert (PlannerGoal (id 2)))
<Fact-2>
CLIPS> (find-all-facts ((?f PlannerGoal)) TRUE)
(<Fact-1> <Fact-2>)
CLIPS> (defmodule EMPTY)
CLIPS> (find-all-facts ((?f PlannerGoal)) TRUE)
[PRNTUTIL1] Unable to find deftemplate PlannerGoal.
CLIPS> (focus PLANNING)
TRUE
CLIPS> (find-all-facts ((?f PlannerGoal)) TRUE)
(<Fact-1> <Fact-2>)
CLIPS> (get-current-module)
PLANNING
CLIPS>