在剪辑中,我在内存中有以下事实。我想通过某种规则重新生成它。当我重新生成它时,它不会将其添加到事实中。因为所有字段值都相同。解决这个问题的方法是什么?
(objct (name food) (edible? yes) (isa Object))
答案 0 :(得分:1)
基本编程指南,第13.4.4节,设置事实的重复行为。 http://clipsrules.sourceforge.net/documentation/v630/bpg.pdf
CLIPS> (clear)
CLIPS> (deftemplate objct (slot name) (slot edible?) (slot isa))
CLIPS> (assert (objct (name food) (edible? yes) (isa Object)))
<Fact-1>
CLIPS> (assert (objct (name food) (edible? yes) (isa Object)))
FALSE
CLIPS> (facts)
f-0 (initial-fact)
f-1 (objct (name food) (edible? yes) (isa Object))
For a total of 2 facts.
CLIPS> (set-fact-duplication TRUE)
FALSE
CLIPS> (assert (objct (name food) (edible? yes) (isa Object)))
<Fact-2>
CLIPS> (facts)
f-0 (initial-fact)
f-1 (objct (name food) (edible? yes) (isa Object))
f-2 (objct (name food) (edible? yes) (isa Object))
For a total of 3 facts.
CLIPS>