在我介绍模块之后,Find-all-facts函数返回“无法找到deftemplate XXX”

问题描述 投票:1回答:1

我改变了我的专家系统核心以使用命名模块。

现在,当我调用find-all-facts函数时,它总是返回

"Unable to find deftemplate 'XXX'"

例如,我的查询看起来像:

(find-all-facts ((?f PlannerGoal )) TRUE)

PlannerGoal deftemplate位于PLANNING模块中。

我也尝试过这样做:

(find-all-facts ((?f PLANNING::PlannerGoal )) TRUE)

但没有变化。我发出(运行)命令后运行此函数。

好像我不明白什么?

谢谢!

clips
1个回答
0
投票

最可能的解释是,您执行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> 
© www.soinside.com 2019 - 2024. All rights reserved.