1

我收到此错误:

[OBJRTBLD2] 现有类的任何对象都不能满足 is-a 对象模式的限制。

当我运行以下规则时:

(defrule update_input "Updateinput1" 
(object (is-a Shmeio) 
(timh ?eis1) 
(onoma "Eisodos 1"))
 => 
(printout t "htane: " ?eis1))

我的代码如下:

(defclass Shmeio
(is-a USER)
(role abstract)
(single-slot timh
(type INTEGER)
;+   (cardinality 1 1)
(create-accessor read-write))
(single-slot onoma
(type STRING)
;+   (cardinality 1 1)
(create-accessor read-write))
(multislot input_at
(type INSTANCE)
(allowed-classes Eksartima)
(create-accessor read-write)))
(defclass Shmeio_Eisodou
(is-a Shmeio)
(role concrete))

(definstances facts
; ...............
([Kuklomata_Class10] of Shmeio_Eisodou
(input_at [Kuklomata_Class74])
(onoma "Eisodos 1")
(timh 21))
([Kuklomata_Class36] of Shmeio_Eisodou
(input_at [Kuklomata_Class76])
(onoma "Eisodos 2")
(timh 28))
([Kuklomata_Class45] of Shmeio_Eisodou
(input_at [Kuklomata_Class77])
(onoma "Eisodos 3")
(timh 13))
([Kuklomata_Class54] of Shmeio_Eisodou
(input_at [Kuklomata_Class77])
(onoma "Eisodos 4")
(timh 25))

有人可以帮我吗?因为我现在被困了几个小时。

4

1 回答 1

1

抽象类是非反应性的(您不能对它们进行模式匹配),并且此行为由子类继承,因此您必须在子类中显式启用此功能。

CLIPS> (defclass A (is-a USER) (role abstract))
CLIPS> (defclass A1 (is-a A) (role concrete))
CLIPS> (defclass A2 (is-a A) (role concrete))
CLIPS> (defrule A-match (object (is-a A)) =>)
[OBJRTBLD2] No objects of existing classes can satisfy is-a restriction in object pattern.

ERROR:
(defrule MAIN::A-match
   (object (is-a A)
CLIPS> (defclass B (is-a USER) (role abstract))
CLIPS> (defclass B1 (is-a B) (role concrete) (pattern-match reactive))
CLIPS> (defclass B2 (is-a B) (role concrete) (pattern-match reactive))
CLIPS> (defrule B-match (object (is-a B)) =>)
CLIPS> 
于 2013-05-06T21:57:38.640 回答