Prntutil2 syntax error check appropriate syntax

У меня в CLIPS (6.3) есть следующие дефшаблоны:... Вопрос о клипах.

У меня есть следующие deftemplates в CLIPS (6.3):

(deftemplate A ( slot a ) (slot b) )
(deftemplate forSearch (slot property)(slot value))

Мне нужно прочитать пару (property, value) из ввода, а затем найти факт A значение которого в слоте property is value.

Если я сделаю что-то вроде этого:

(defrule r2
(forSearch (property ?c)(value ?d))
(A (?c ?d))
=>
(printout t "debug" crlf)
)

Я получаю следующее сообщение об ошибке:

[PRNTUTIL2] Syntax Error:  Check appropriate syntax for deftemplate patterns.

ERROR:
(defrule MAIN::r2
   (forSearch (property ?c) (value ?d))
   (A (?c

Что мне теперь делать?

1 ответы

Вы должны написать имя слота в части соответствия шаблону правила.

Правильный синтаксис:

(defrule r2
     (forSearch (property ?c)(value ?d))
     (A (a ?c) (b ?d))
     =>
     (printout t "debug" crlf)
)

Я не понимаю, чего вы хотите добиться, и я знаю, что уже поздно, но надеюсь, что это поможет.

ответ дан 06 апр.

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками

clips

or задайте свой вопрос.

TRUE CLIPS> (batch «bpgf3err.bat») TRUE CLIPS> (defgeneric ()) [CSTRCPSR2] Missing name for defgeneric construct ERROR: (defgeneric ( CLIPS> (if (> 3 4)) [PRNTUTIL2] Syntax Error: Check appropriate syntax for if function. CLIPS> (deffacts info (fact ?x)) [PRNTUTIL6] Local variables can not be accessed by a deffacts construct. ERROR: (deffacts MAIN::info (fact ?x)) CLIPS> (defmethod foo () (+ ?a 2)) [PRCCODE3] Undefined variable a referenced in method. ERROR: (defmethod MAIN::foo () (+ ?a 2) ) CLIPS> (deffunction foo ($?wild ?a)) [PRCCODE8] No parameters allowed after wildcard parameter. ERROR: (deffunction MAIN::foo ($?wild ?a CLIPS> (deffunction foo (?a ?a)) [PRCCODE7] Duplicate parameter names not allowed. ERROR: (deffunction MAIN::foo (?a ?a CLIPS> (assert (fact 1 (fact 2))) [EXPRNPSR3] Missing function declaration for fact. CLIPS> (assert ()) [PRNTUTIL2] Syntax Error: Check appropriate syntax for first field of a RHS pattern. CLIPS> (assert) [PRNTUTIL2] Syntax Error: Check appropriate syntax for assert command. CLIPS> (+ (~ 3 4) 4) [EXPRNPSR1] A function name must be a symbol CLIPS> (xyz) [EXPRNPSR3] Missing function declaration for xyz. CLIPS> (<= ~ 4) [EXPRNPSR2] Expected a constant, variable, or expression. CLIPS> (defrule error (declare (priority 10)) =>) [PRNTUTIL2] Syntax Error: Check appropriate syntax for declare statement. ERROR: (defrule MAIN::error (declare (priority CLIPS> (defrule error (declare (salience a)) =>) [PRNTUTIL10] Salience value must be an integer value. ERROR: (defrule MAIN::error (declare (salience a CLIPS> (defrule error (declare (salience 20000)) =>) [PRNTUTIL9] Salience value out of range -10000 to 10000. ERROR: (defrule MAIN::error (declare (salience 20000 CLIPS> (defrule error (or) =>) [PRNTUTIL2] Syntax Error: Check appropriate syntax for the or conditional element. ERROR: (defrule MAIN::error (or) CLIPS> (defrule error (not ?f <- (fact)) =>) [RULELHS2] A pattern CE cannot be bound to a pattern-address within a not CE ERROR: (defrule MAIN::error (not ?f CLIPS> (defrule error () =>) [PRNTUTIL2] Syntax Error: Check appropriate syntax for the first field of a pattern. ERROR: (defrule MAIN::error () CLIPS> (defrule error (test (> 3 4)) =>) CLIPS> (defrule error (a) (logical (b)) =>) [RULEPSR1] Logical CEs must be placed first in a rule ERROR: (defrule MAIN::error (a) (logical (b)) =>) CLIPS> (defrule error (logical (a)) (b) (logical (c)) =>) [RULEPSR2] Gaps may not exist between logical CEs ERROR: (defrule MAIN::error (logical (a)) (b) (logical (c)) =>) CLIPS> (defrule error => (assert (a ?f))) [PRCCODE3] Undefined variable f referenced in RHS of defrule. ERROR: (defrule MAIN::error => (assert (a ?f))) CLIPS> (defrule error => (retract ?f)) [PRCCODE3] Undefined variable f referenced in RHS of defrule. ERROR: (defrule MAIN::error => (retract ?f)) CLIPS> (defrule error (fact) (test (> ?f 4)) =>) [ANALYSIS4] Variable ?f found in the expression (> ?f 4) was referenced in CE #2 before being defined. ERROR: (defrule MAIN::error (fact) (test (> ?f 4)) =>) CLIPS> (defrule error ?f <- (a ?f) =>) CLIPS> (defrule error ?f <- (a) ?f <- (b) =>) [ANALYSIS1] Duplicate pattern-address ?f found in CE #2. ERROR: (defrule MAIN::error ?f <- (a) ?f <- (b) =>) CLIPS> (defrule error (a ~?f) =>) [ANALYSIS4] Variable ?f was referenced in CE #1 field #1 before being defined. ERROR: (defrule MAIN::error (a ~?f) =>) CLIPS> (deftemplate error (multifield x) (multifield y)) CLIPS> (deftemplate error (field x (allowed-types word))) [PRNTUTIL2] Syntax Error: Check appropriate syntax for slot attributes. ERROR: (deftemplate MAIN::error (field x (allowed-types CLIPS> (deftemplate example (field x (default a) (default b))) [PRNTUTIL5] The default attribute has already been parsed. ERROR: (deftemplate MAIN::example (field x (default a) (default CLIPS> (deftemplate error (multifield x (default 3 ?NONE))) [PRNTUTIL2] Syntax Error: Check appropriate syntax for default attribute. ERROR: (deftemplate MAIN::error (multifield x (default 3 ?NONE CLIPS> (deftemplate error (multifield x (default ?NONE 3))) [PRNTUTIL2] Syntax Error: Check appropriate syntax for default attribute. ERROR: (deftemplate MAIN::error (multifield x (default ?NONE 3 CLIPS> (deftemplate error (field x (default ~))) [EXPRNPSR2] Expected a constant, variable, or expression. ERROR: (deftemplate MAIN::error (field x (default ~ CLIPS> (deftemplate error (field x (default))) [DEFAULT1] The default value for a single field slot must be a single field value ERROR: (deftemplate MAIN::error (field x (default) CLIPS> (deftemplate example (field x)) CLIPS> (assert (example (x))) [TMPLTDEF2] The single field slot x can only contain a single field value. CLIPS> (assert (example (x a b))) [TMPLTDEF2] The single field slot x can only contain a single field value. CLIPS> (defrule error ?f <- (example) => (modify ?f (x))) [TMPLTDEF2] The single field slot x can only contain a single field value. ERROR: (defrule MAIN::error ?f <- (example) => (modify ?f (x))) CLIPS> (defrule error ?f <- (example) => (modify ?f (x 3 4))) [TMPLTDEF2] The single field slot x can only contain a single field value. ERROR: (defrule MAIN::error ?f <- (example) => (modify ?f (x 3 4))) CLIPS> (deftemplate example (field x)) CLIPS> (assert (example (x =(mv-append a b c)))) [TMPLTDEF2] The single field slot x can only contain a single field value. CLIPS> (deftemplate example (field x)) CLIPS> (assert (example (x a) (x b))) [PRNTUTIL5] The slot x has already been parsed. CLIPS> (deftemplate example (field x)) CLIPS> (defrule error (example|other (x 3)) =>) [PRNTUTIL2] Syntax Error: Check appropriate syntax for deftemplate patterns. ERROR: (defrule MAIN::error (example| CLIPS> (deftemplate example (field x)) CLIPS> (defrule error (example (z 3)) =>) [TMPLTDEF1] Invalid slot z not defined in corresponding deftemplate example. ERROR: (defrule MAIN::error (example (z CLIPS> (undeftemplate example) CLIPS> (defrule error ?f <- (example) => (modify ?f (x 3))) CLIPS> (defrule error => (modify 1 (x 3))) [TMPLTFUN1] Fact-indexes can only be used by modify as a top level command. ERROR: (defrule MAIN::error => (modify 1 CLIPS> (deftemplate example (field x (type INTEGER))) CLIPS> (defrule testit (example (x a)) =>) [CSTRNCHK1] A literal restriction value found in CE #1 does not match the allowed types for slot x. ERROR: (defrule MAIN::testit (example (x a)) =>) CLIPS> (deftemplate example (field x (type INTEGER))) CLIPS> (assert (example (x =(float 3)))) [CSTRNCHK1] The function return value found in the assert command does not match the allowed types for slot x. CLIPS> (deftemplate example (field x (allowed-integers 1 2 3))) CLIPS> (defrule testit (example (x 4)) =>) [CSTRNCHK1] A literal restriction value found in CE #1 does not match the allowed values for slot x. ERROR: (defrule MAIN::testit (example (x 4)) =>) CLIPS> (deftemplate example (field x (range 1 3))) CLIPS> (assert (example (x 4))) [CSTRNCHK1] A literal slot value found in the assert command does not fall in the allowed range 1 to 3 for slot x. CLIPS> (deftemplate example1 (field x (type SYMBOL) (allowed-integers 1 2 3))) [CSTRNPSR1] The type attribute conflicts with the allowed-integers/numbers attribute. ERROR: (deftemplate MAIN::example1 (field x (type SYMBOL) (allowed-integers 1 2 3)) CLIPS> (deftemplate example2 (field x (range 1 3) (default 5))) [CSTRNCHK1] An expression found in the default attribute does not fall in the allowed range 1 to 3 for slot x. ERROR: (deftemplate MAIN::example2 (field x (range 1 3) (default 5)) CLIPS> (deftemplate example3 (field x (type SYMBOL) (range 1 5))) [CSTRNPSR1] The type attribute conflicts with the range attribute. ERROR: (deftemplate MAIN::example3 (field x (type SYMBOL) (range 1 5)) CLIPS> (deftemplate example (field x)) CLIPS> (defglobal ?*x* = (mv-append a b c)) CLIPS> (assert (example (x ?*x*))) [TMPLTFUN2] Attempted to assert a multifield value into the single field slot x of deftemplate example. FALSE CLIPS> (deftemplate example (field x (allowed-values a b 2 3) (allowed-integers 4 5 6))) [CSTRNPSR3] The allowed-integers attribute cannot be used in conjunction with the allowed-values attribute. ERROR: (deftemplate MAIN::example (field x (allowed-values a b 2 3) (allowed-integers CLIPS> (deftemplate example (field x (allowed-integers 1 2 3) (range 4 6))) [CSTRNPSR3] The range attribute cannot be used in conjunction with the allowed-integers attribute. ERROR: (deftemplate MAIN::example (field x (allowed-integers 1 2 3) (range CLIPS> (deftemplate example (field x (type ?VARIABLE INTEGER))) [PRNTUTIL2] Syntax Error: Check appropriate syntax for type attribute. ERROR: (deftemplate MAIN::example (field x (type ?VARIABLE INTEGER CLIPS> (deftemplate example (field x (type INTEGERFLOAT))) [PRNTUTIL2] Syntax Error: Check appropriate syntax for type attribute. ERROR: (deftemplate MAIN::example (field x (type INTEGERFLOAT CLIPS> (deftemplate example (field x (allowed-integers 3.0))) [CSTRNPSR4] Value does not match the expected type for the allowed-integers attribute ERROR: (deftemplate MAIN::example (field x (allowed-integers 3.0 CLIPS> (deftemplate example (field x (min-number-of-elements 3))) [PRNTUTIL2] Syntax Error: Check appropriate syntax for slot attributes. ERROR: (deftemplate MAIN::example (field x (min-number-of-elements CLIPS> (defglobal ?x = 3) [PRNTUTIL2] Syntax Error: Check appropriate syntax for defglobal. ERROR: (defglobal MAIN ?x CLIPS> (deffunction defgeneric ()) [DFFNXPSR1] Deffunctions are not allowed to replace constructs. ERROR: (deffunction MAIN::defgeneric ( CLIPS> (deffunction + ()) [DFFNXPSR2] Deffunctions are not allowed to replace external functions. ERROR: (deffunction MAIN::+ ( CLIPS> (defgeneric foo) CLIPS> (deffunction foo ()) [DFFNXPSR3] Deffunctions are not allowed to replace generic functions. ERROR: (deffunction MAIN::foo ( CLIPS> (clear) CLIPS> (deffunction foo) [PRNTUTIL2] Syntax Error: Check appropriate syntax for parameter list. ERROR: (deffunction MAIN::foo) CLIPS> (deffunction foo (?a abc)) [PRNTUTIL2] Syntax Error: Check appropriate syntax for parameter list. ERROR: (deffunction MAIN::foo (?a abc CLIPS> (deffunction foo () (build «(deffunction foo ())»)) CLIPS> (foo) [DFNXPSR4] Deffunction foo may not be redefined while it is executing. ERROR: (deffunction MAIN::foo ( FALSE CLIPS> (defgeneric deffunction) [GENRCPSR3] Defgenerics are not allowed to replace constructs. ERROR: (defgeneric MAIN::deffunction) CLIPS> (clear) CLIPS> (deffunction foo ()) CLIPS> (defgeneric foo) [GENRCPSR5] Defgenerics are not allowed to replace deffunctions. ERROR: (defgeneric MAIN::foo) CLIPS> (clear) CLIPS> (defgeneric foo ()) [GENRCPSR1] Expected ‘)’ to complete defgeneric. ERROR: (defgeneric MAIN::foo ( CLIPS> (defgeneric) [CSTRCPSR2] Missing name for defgeneric construct ERROR: (defgeneric ) CLIPS> (clear) CLIPS> (defmethod foo 1 ((?a INTEGER))) CLIPS> (defmethod foo 2 ((?a INTEGER))) [GENRCPSR2] New method #2 would be indistinguishable from method #1. ERROR: (defmethod MAIN::foo 2 ((?a INTEGER)) CLIPS> (clear) CLIPS> (defmethod foo 0 ()) [GENRCPSR6] Method index out of range. ERROR: (defmethod MAIN::foo 0 CLIPS> (clear) CLIPS> (defmethod foo) [GENRCPSR7] Expected a ‘(‘ to begin method parameter restrictions. ERROR: (defmethod MAIN::foo) CLIPS> (clear) CLIPS> (defmethod foo (abc)) [GENRCPSR9] Expected a variable or ‘(‘ for parameter specification. ERROR: (defmethod MAIN::foo (abc CLIPS> (clear) CLIPS> (defmethod foo ((abc))) [GENRCPSR8] Expected a variable for parameter specification. ERROR: (defmethod MAIN::foo ((abc CLIPS> (clear) CLIPS> (defmethod foo ((?a (< ?a 1) INTEGER))) [GENRCPSR10] Query must be last in parameter restriction. ERROR: (defmethod MAIN::foo ((?a (< ?a 1) INTEGER CLIPS> (clear) CLIPS> (defmethod foo ((?a INTEGER INTEGER))) [GENRCPSR11] Duplicate classes not allowed in parameter restriction. ERROR: (defmethod MAIN::foo ((?a INTEGER INTEGER CLIPS> (clear) CLIPS> (defmethod foo ((?a INTEGER NUMBER))) [GENRCPSR15] INTEGER class is redundant. ERROR: (defmethod MAIN::foo ((?a INTEGER NUMBER CLIPS> (clear) CLIPS> (defmethod foo ((?a (bind ?b 1)))) [GENRCPSR12] Binds are not allowed in query expressions. ERROR: (defmethod MAIN::foo ((?a (bind ?b 1) CLIPS> (clear) CLIPS> (defmethod foo ((?a 34))) [GENRCPSR13] Expected a valid class name or query. ERROR: (defmethod MAIN::foo ((?a 34 CLIPS> (clear) CLIPS> (defmethod foo ((?a bogus-class))) [GENRCPSR14] Unknown class in method. ERROR: (defmethod MAIN::foo ((?a bogus-class CLIPS> (clear) CLIPS> (defclass A (is-a USER)) CLIPS> (defmethod foo ((?a A LEXEME))) CLIPS> (defclass A (is-a OBJECT))) [CLASSPSR3] A class cannot be redefined while outstanding references to it still exist. ERROR: (defclass MAIN::A ( CLIPS> (clear) CLIPS> (defclass STRING (is-a NUMBER)) [CLASSPSR2] Cannot redefine a predefined system class. ERROR: (defclass MAIN::STRING ( CLIPS> (clear) CLIPS> (defclass A (is-a A)) [INHERPSR1] A class may not have itself as a superclass. ERROR: (defclass MAIN::A (is-a A CLIPS> (clear) CLIPS> (defclass A (is-a USER USER)) [INHERPSR2] A class may inherit from a superclass only once. ERROR: (defclass MAIN::A (is-a USER USER CLIPS> (clear) CLIPS> (defclass B (is-a A)) [INHERPSR3] A class must be defined after all its superclasses. ERROR: (defclass MAIN::B (is-a A CLIPS> (clear) CLIPS> (defclass A (is-a USER)) CLIPS> (defclass B (is-a A)) CLIPS> (defclass C (is-a B)) CLIPS> (defclass A (is-a C)) [INHERPSR5] Partial precedence list formed: A Precedence loop in superclasses: A B C A ERROR: (defclass MAIN::A (is-a C) CLIPS> (clear) CLIPS> (defclass A (is-a)) [INHERPSR4] Must have at least one superclass. ERROR: (defclass MAIN::A (is-a ) CLIPS> (defclass A (is-a USER) (role abstract) (role concrete)) [CLASSPSR4] Class role already declared. ERROR: (defclass MAIN::A (is-a USER) (role abstract) (role CLIPS> (defclass A (is-a USER) (slot foo (default 1) (default 2))) [CLSLTPSR2] default facet already specified. ERROR: (defclass MAIN::A (is-a USER) (slot foo (default 1) (default CLIPS> (defclass A (is-a USER) (slot foo (access read-only) (access initialize-only))) [CLSLTPSR2] access facet already specified. ERROR: (defclass MAIN::A (is-a USER) (slot foo (access read-only) (access CLIPS> (defclass A (is-a USER) (slot foo (default 1 2 3 4))) [INSFUN7] (1 2 3 4) illegal for single-field slot foo found in slot default value. ERROR: (defclass MAIN::A (is-a USER) (slot foo (default 1 2 3 4)) CLIPS> (defclass A (is-a USER) (slot foo) (slot foo)) [CLSLTPSR1] Duplicate slots not allowed. ERROR: (defclass MAIN::A (is-a USER) (slot foo) (slot foo CLIPS> (defclass A (is-a OBJECT USER)) [INHERPSR5] Partial precedence list formed: Precedence loop in superclasses: OBJECT USER OBJECT ERROR: (defclass MAIN::A (is-a OBJECT USER) CLIPS> (defmessage-handler bogus-class foo ()) [MSGPSR1] A class must be defined before its message-handlers. ERROR: (defmessage-handler MAIN::bogus-class foo CLIPS> (defclass A (is-a USER) (role concrete)) CLIPS> (make-instance a of A) [a] CLIPS> (defmessage-handler A build-new () (build «(defmessage-handler A new ())»)) CLIPS> (send [a] build-new) [MSGPSR2] Cannot (re)define message-handlers during execution of other message-handlers for the same class. ERROR: (defmessage-handler MAIN::A new FALSE CLIPS> (defmessage-handler USER init ()) [MSGPSR3] System message-handlers may not be modified. ERROR: (defmessage-handler MAIN::USER init ( CLIPS> (clear) CLIPS> (defclass A (is-a USER) (slot foo (create-accessor read-write))) CLIPS> (defmessage-handler A get-foo ()) [MSGPSR3] System message-handlers may not be modified. ERROR: (defmessage-handler MAIN::A get-foo ( CLIPS> (defmessage-handler USER foo (?self:bar)) [MSGPSR4] Illegal slot reference in parameter list. ERROR: (defmessage-handler MAIN::USER foo (?self:bar CLIPS> (defmessage-handler USER foo () (bind ?self 1)) [MSGPSR5] Active instance parameter cannot be changed. ERROR: (defmessage-handler MAIN::USER foo () (bind ?self 1) ) CLIPS> (defmessage-handler USER foo () (dynamic-put bar 1)) CLIPS> (clear) CLIPS> (defclass A (is-a USER) (role concrete) (slot foo (create-accessor write))) CLIPS> (definstances A-objects (a of A (foo (build «(definstances A-objects (b of A))»)))) CLIPS> (reset) [CSTRCPSR4] Cannot redefine definstances A-objects while it is in use. ERROR: (definstances MAIN::A-objects CLIPS> (any-instancep ((?a OBJECT) (?a OBJECT)) TRUE) [INSQYPSR1] Duplicate instance member variable name in function any-instancep. CLIPS> (any-instancep ((?a OBJECT) (?b OBJECT)) (bind ?c 1)) [INSQYPSR2] Binds are not allowed in instance-set query in function any-instancep. CLIPS> (do-for-all-instances ((?a USER)) (if (slot-existp ?a age) then (> ?a:age 30)) (bind ?a (send ?a get-brother))) [INSQYPSR3] Cannot rebind instance-set member variable a in function do-for-all-instances. CLIPS> (dribble-off)

Я пытаюсь создать программу, которая спрашивает, является ли заявитель бездомным, безработный и т. Д. И получает в качестве ответа поддержку уровня 1 или 2, но я не могу загрузить это в Clips. Я получаю ошибку ниже

код

(defrule Claimant
(Claimant-is homeless)
(Claimant-is unemployed)
(Claimant-is nosavings)
(Claimant-is dependants)
(Claimant-is disabled))

(deftemplate Benefit
   (slot benefit))

(defrule Level1
   Claimant(homesless yes) (unemployed yes) (nosavings no) (dependants yes) (disabled yes))
   =>
   (assert (Benefit (benefit level1)))
   (printout t "You get level 1 benefit support" crlf))

(defrule Level2
   Claimant(homesless yes) (unemployed yes) (nosavings no) (dependants no) (disabled no))
   =>
   (assert (Benefit (benefit level2)))
   (printout t "You get level 2 benefit support" crlf))

ошибка

Defining defrule: Claimant 
[PRNTUTIL2] Syntax Error:  Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::Claimant
   (Claimant-is homeless)
   (Claimant-is unemployed)
   (Claimant-is nosavings)
   (Claimant-is dependants)
   (Claimant-is disabled)
   )
Defining deftemplate: Benefit
Defining defrule: Level1 
[PRNTUTIL2] Syntax Error:  Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::Level1
   Claimant
Defining defrule: Level2 
[PRNTUTIL2] Syntax Error:  Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::Level2
   Claimant
FALSE
CLIPS> 

1 ответ

Лучший ответ

В вашем синтаксисе есть несколько проблем, которые необходимо исправить.

Дизайн также можно упростить (но я не буду говорить об этом аспекте).

Ниже показана эквивалентная версия с исправлениями.

homeless.clp

(deftemplate Claimant
  (slot homeless (type SYMBOL) (allowed-values yes no))
  (slot unemployed (type SYMBOL) (allowed-values yes no))
  (slot nosavings (type SYMBOL) (allowed-values yes no))
  (slot dependants (type SYMBOL) (allowed-values yes no))
  (slot disabled (type SYMBOL) (allowed-values yes no))
)

(deftemplate Benefit
   (slot benefit (type SYMBOL) (allowed-values level1 level2))
)

(defrule Level1
   (Claimant (homeless yes) (unemployed yes) (nosavings no)
             (dependants yes) (disabled yes))
   =>
   (assert (Benefit (benefit level1)))
   (printout t "You get level 1 benefit support" crlf)
)

(defrule Level2
   (Claimant (homeless yes) (unemployed yes) (nosavings no)
             (dependants no) (disabled no))
   =>
   (assert (Benefit (benefit level2)))
   (printout t "You get level 2 benefit support" crlf)
)

Теперь вы можете протестировать

(clear)

(load "homeless.clp")

(assert (Claimant (homeless yes) (unemployed yes) (nosavings no) (dependants no) (disabled no)))

(run) 

И получить

You get level 2 benefit support


1

AMFVargas
13 Янв 2015 в 19:34

Appendix G CLIPS Error Messages

CLIPS typically will display two kinds of error messages: those associated with executing constructs and those associated with loading constructs. This appendix describes some of the more common error messages and what they mean. Each message begins with a unique identifier enclosed in brackets; the messages are listed here in alphabetic order according to the identifier.[AGENDA1] Salience value must be an integer value.

Salience requires a integer argument and will otherwise result in this error message.

The range of allowed salience has an explicit limit; this error message will result if the value is out of that range.

When an error results from evaluating a salience value for a rule, this error message is given.[ANALYSIS1] Duplicate patternaddress found in CE .

This message occurs when two facts or instances are bound to the same patternaddress variable.

A variable first bound within a pattern cannot be later bound to a factaddress.

Variables on the LHS of a rule cannot be bound to both single and multifield variables.

A variable cannot be referenced before it is defined and, thus, results in this error message.

This error occurs when a function receives less than the minimum number or more than the maximum number of argument(s) expected.[ARGACCES2] Function was unable to open file

This error occurs when the specified function cannot open a file.[ARGACCES3] Function received a request from function for argument # which is nonexistent

This error occurs when a function is passed fewer arguments than were expected.[ARGACCES4] Function expected exactly argument(s)

This error occurs when a function that expects a precise number of argument(s) receives an incorrect number of arguments.[ARGACCES4] Function expected at least argument(s)

This error occurs when a function does not receive the minimum number of argument(s) that it expected.[ARGACCES4] Function expected no more than argument(s)

This error occurs when a function receives more than the maximum number of argument(s) expected.[ARGACCES5] Function expected argument # to be of type

This error occurs when a function is passed the wrong type of argument.[ARGACCES6] Function received a request from function for argument # which is not of type

This error occurs when a function requests from another function the wrong type of argument, typically a string or symbol , when expecting a number or vice versa.[BLOAD1] Cannot load construct with binary load in effect.

If the bload command was used to load in a binary image, then the named construct cannot be entered until a clear command has been performed to remove the binary image.[BLOAD2] File is not a binary construct file

This error occurs when the bload command is used to load a file that was not created with the bsave command.[BLOAD3] File is an incompatible binary construct file

This error occurs when the bload command is used to load a file that was created with the bsave command using a different version of CLIPS.[BLOAD4] The CLIPS environment could not be cleared.Binary load cannot continue.

A binary load cannot be performed unless the current CLIPS environment can be cleared.[BLOAD5] Some constructs are still in use by the current binary image:

.
Binary cannot continue.

This error occurs when the current binary image cannot be cleared because some constructs are still being used. The in progress may either be a binary load or a binary clear.[BLOAD6] The following undefined functions are referenced by this binary image:

.

This error occurs when a binary image is loaded that calls functions which were available in the CLIPS executable that originally created the binary image, but which are not available in the CLIPS executable that is loading the binary image.[BSAVE1] Cannot perform a binary save while a binary load is in effect.

The bsave command does not work when a binary image is loaded.[CLASSEXM1] Inherited slot from class is not valid for function slotpublicp

This error message occurs when the function slotpublicp is given an inherited slot. This function can only be used on slots defined in the given class.

This error message occurs when a function is given a nonexistent class name.

This error is usually caused by too many simultaneously active instanceset queries, e.g., doforallinstances . The direct or indirect nesting of instanceset query functions is limited in the following way:

Ci is the number of members in an instanceset for the ith nested instanceset query function.

N is the number of nested instanceset query functions.

The default upper limit of 128 should be sufficient for most if not all applications. However, the limit may be increased by editing the header file OBJECT.H and recompiling CLIPS.[CLASSPSR1] An abstract class cannot be reactive.

Only concrete classes can be reactive.

Predefined system classes cannot be modified by the user.

This error occurs when an attempt to redefine a class is made under one or both of the following two circumstances:

1) The class (or any of its subclasses) has instances.

2) The class (or any of its subclasses) appear in the parameter restrictions of any generic function method.

Before the class can be redefined, all such instances and methods must be deleted.

Only one specification of a class attribute is allowed.

Slots in a defclass must be unique.

Only one occurrence of a facet per slot is allowed.

Singlefield slots by definition have a cardinality of one.

Since slots cannot be unbound and readonly slots cannot be set after initial creation of the instance, readonly slots must have a default value.

Since readonly slots cannot be changed after initializationof the instance, a write accessor ( put messagehandler) is not allowed.

noinherit slots are by definition not accessible to subclasses and thus only visible to the parent class.

This message occurs when a toplevel command does not begin with a ‘(‘, constant, or global variable.

This message occurs when a toplevel command is not a symbol.

A ‘.’ cannot be used in the file name prefix that is passed to the constructstoc command since this prefix is used to generate file names and some operating systems do not allow more than one ‘.’ to appear in a file name.[CONSTRCT1] Some constructs are still in use. Clear cannot continue.

This error occurs when the clear command is issued when a construct is in use (such as a rule that is firing).[CSTRCPSR1] Expected the beginning of a construct.

This error occurs when the load command expects a left parenthesis followed a construct type and these token types are not found.[CSTRCPSR2] Missing name for construct

This error occurs when the name is missing for a construct that requires a name.

or[CSTRCPSR3] Cannot define defmodule because of an import/export conflict cause by the .

A construct cannot be defined if defining the construct would allow two different definitions of the same construct type and name to both be visible to any module.

A construct cannot be redefined while it is being used by another construct or other data structure (such as a fact or instance).

This error ID covers a range of messages indicating a type, value, range, or cardinality violation.

This error message occurs when two slot attributes conflict.

The minimum attribute value for the range and cardinality attributes must be less than or equal to the maximum attribute value for the attribute.

The use of some slot attributes excludes the use of other slot attributes.

The arguments to an attribute must match the type expected for that attribute (e.g. integers must be used for the allowedintegers attribute).

The cardinality attribute can only be used for slots defined with the multislot keyword.

This error occurs when the default or defaultdynamic attribute for a singlefield slot does not contain a single value or an expression returning a single value.

A deffunction cannot have the same name as any construct.

A deffunction cannot have the same name as any system or userdefined external function.

A deffunction cannot have the same name as any generic function.

A deffunction can be loaded at any time except when a deffunction of the same name is already executing.

[DFFNXPSR5] Defgeneric imported from module conflicts with this deffunction.

A deffunction cannot have the same name as any generic function imported from another module.

This error pinpoints other evaluation errors associated with evaluating an expression within the join network. The specific pattern of the problem rules is identified.[EMATHFUN1] Domain error for function

This error occurs when an argument passed to a math function is not in the domain of values for which a return value exists.[EMATHFUN2] Argument overflow for function

This error occurs when an argument to an extended math function would cause a numeric overflow.[EMATHFUN3] Singularity at asymptote in function

This error occurs when an argument to a trigonometric math function would cause a singularity.[EVALUATN1] Variable is unbound

This error occurs when a local variable not set by a previous call to bind is accessed at the top level.

In the following example, ‘

‘ is recognized by CLIPS as an operator, not a function:

In the following example, ‘

‘ is an operator and is illegal as an argument to a function call:

CLIPS does not recognize as a declared function and gives this error message.

The sequence expansion operator cannot be used with certain functions.

This error pinpoints other evaluation errors associated with evaluating an expression within the pattern network. The specific pattern and field of the problem rules are identified.[FACTMNGR1] Facts may not be retracted during patternmatching

or[FACTMNGR2] Facts may not be retracted during patternmatching

Functions used on the LHS of a rule should not have side effects (such as the creation of a new instance or fact).

This error occurs when an assert is attempted for a deftemplate which does not exist in a runtime or active bload image. In other situations, CLIPS will create an implied deftemplate if one does not already exist.

This error occurs when the generic function name passed to the undefmethod function does not exist.

This error occurs when an invalid method index is passed to undefmethod (e.g. a negative integer or a symbol other than *).

It is illegal to specify a nonwildcard method index when a wildcard is given for the generic function in the function undefmethod .

A method corresponding to a system defined function cannot be deleted.

The generic function call arguments do not satisfy any methodís parameter restrictions.

No shadowed method is available when the function callnextmethod is called.

The class or type of a generic function argument could not be determined for comparison to a method type restriction.

This error occurs when callspecificmethod is called with an inappropriate set of arguments for the specified method.

Defgenerics canít be redefined while one of their methods is currently executing.

No generic function method of the specified index could be found by the named function.

No generic function method of the specified index could be found by the named function.

A right parenthesis completes the definition of a generic function header.

An explicit index has been specified for a new method that does not match that of an older method which has identical parameter restrictions.

A generic function cannot have the same name as any construct.

[GENRCPSR4] Deffunction imported from module conflicts with this defgeneric.

A deffunction cannot have the same name as any generic function imported from another module.

A generic function cannot have the same name as any deffunction.[GENRCPSR6] Method index out of range.

A method index cannot be greater than the maximum value of an integer or less than 1.

A left parenthesis must begin a parameter restriction list for a method.

A method parameter with restrictions must be a variable.

A method parameter must be a variable with or without restrictions.

A query parameter restriction must follow a type parameter restriction (if any).

A method type parameter restriction may have only a single occurrence of a particular class.

Binding new variables in a method query parameter restriction is illegal.

Method parameter restrictions consist of zero or more class names and an optional query expression.

Classes in method type parameter restrictions must already be defined.

All classes in a method type parameter restriction should be unrelated.

Some system functions canot be overloaded.

A system function can not be overloaded with a method that has the exact number and types of arguments.

A global variable must be defined before it can be accessed at the command prompt or elsewhere.

A global variable must be defined before it can be accessed at the command prompt or elsewhere.

The incremental reset behaviour can only be changed when there are no currently defined rules.[INHERPSR1] A class may not have itself as a superclass.

A class may not inherit from itself.

All direct superclasses of a class must be unique.

Subclasses must be defined last.

All userdefined classes must have at least one direct superclass.

No class precedence list satisfies the rules specified in section 9.3.1.1 for the given direct superclass list. The message shows a conflict for because the precedence implies that must both precede and succeed through . The full loop can be used to help identify which particular classes are causing the problem. This loop is not necessarily the only loop in the precedence list; it is the first one detected. The part of the precedence list which was successfully formed is also listed.

The INSTANCE, INSTANCENAME, and INSTANCEADDRESS classes cannot have any subclasses.

The evaluation of an expression yielded something other than a recognized class or primitive type.[INSFILE1] Function could not completely process file .

This error occurs when an instance definition is improperly formed in the input file for the loadinstances , restoreinstances , or bloadinstances command.

or[INSFILE3] file is not a compatible binary instances file.

This error occurs when bloadinstances attempts to load a file that was not created with bsaveinstances or when the file being loaded was created by a different version of CLIPS.

This error occurs when an instance specification in the input file for the bloadinstances command could not be created.

The named function expected an instancename or address as an argument.

This error occurs when the named function cannot find the specified instance.

This error occurs when the named function cannot find the specified slot in an instance or class.

This error occurs when an attempt is made to use the address of a deleted instance.

CLIPS does not allow reactive instance slots to be changed while patternmatching is taking place. Functions used on the LHS of a rule should not have side effects (such as the changing slot values).

This error occurs when the number of simultaneous class hierarchy traversals is exceeded while patternmatching on a shared slot. See the related error message [CLASSFUN2] for more details.[INSFUN7] illegal for singlefield slot of instance found in .

Singlefield slots in an instance can hold only one atomic value.

Only functions which have a return value can be used to generate values for an instance slot.

makeinstance expects a symbol or an instancename for the name of a new instance.

makeinstance expects a symbol for the class of a new instance.

Direct instances of abstract classes, such as the predefined system classes, are illegal.

The initialization of an instance is recursive in that a slotoverride or defaultvalue tries to create or reinitialize the same instance.

makeinstance will attempt to delete an old instance of the same name if it exists. This error occurs if that deletion fails.

The evaluation of a slotoverride in makeinstance or initializeinstance attempted to delete the instance.

An instance cannot be reinitialized during initialization.

This message is displayed when an evaluation error occurs while the init message is executing for an instance.[INSMNGR9] Expected a valid slot name for slotoverride.

makeinstance and initializeinstance expect symbols for slot names.

CLIPS does not allow instances of reactive classes to be created while patternmatching is taking place. Functions used on the LHS of a rule should not have side effects (such as the creation of a new instance or fact).

This error occurs when the module specifier in the instancename is illegal (such as an undefined module name).

CLIPS does not allow instances of reactive classes to be deleted while patternmatching is taking place. Functions used on the LHS of a rule should not have side effects (such as the deletion of a new instance or the retraction of a fact).

This error occurs when the slot name of a slot override does not correspond to any of the valid slot names for an instance.

If the ?NONE keyword was specified with the default attribute for a slot, then a slot override must be provided when an instance containing that slot is created.

The special function initslots (for initializing slots of an instance to the class default values) can only be called during the dispatch of an init message for an instance, i.e., in an init messagehandler.

[INSMODDP1] Direct/messagemodify message valid only in modifyinstance.

The directmodify and messagemodify messagehandlers attached to the class USER can only be called as a result of the appropriate message being sent.by the modifyinstance or messagemodifyinstance functions. Additional handlers may be defined, but the message can only be sent in this context.

The directduplicate and messageduplicate messagehandlers attached to the class USER can only be called as a result of the appropriate message being sent.by the duplicateinstance or messageduplicateinstance functions. Additional handlers may be defined, but the message can only be sent in this context.

If an instancename is specified for the new instance in the call to duplicateinstance , it must be different from the source instanceís name.

The functions described in section 12.13.4.12, such as slotinsert$ , can only operate on multifield slots.

Instanceset member variables in an instanceset query function must be unique.

An instanceset query cannot bind variables.

Instanceset member variables cannot be changed within the actions of an instanceset query function.

A logical name must be either a symbol, string, instancename, float, or integer.

A logical name cannot be associated with two different files.

This error indicates insufficient memory exists to expand internal structures enough to allow continued operation (causing an exit to the operating system).[MEMORY2] Release error in genfree

This error indicates a problem in the memory management routines.[MEMORY3] Unable to allocate memory block > 32K

This error occurs when the bload function attempts to allocate a block of memory larger than 32K and the operating system does not permit blocks greater than 32K to be allocated. This will only occur on machines which have 2 byte integers (excluding the Macintosh and IBM PC which have machine dependent code provided so that they can allocate more than 32K). When this error occurs, CLIPS exits to the operating system.[MISCFUN1] expand$ must be used in the argument list of a function call.

The expand$ function may not be called unless it is within the argument list of another function.

The module specifier can only be used as part of a defined constructís name or as an argument to a function.

or[MODULPSR1] Module does not export any constructs.

or[MODULPSR1] Module does not export the .

A construct cannot be imported from a module unless the defmodule exports that construct.

It is illegal to specify a nonwildcard handler index when a wildcard is given for the class in the external C function UndefmessageHandler() . This error can only be generated when a userdefined external function linked with CLIPS calls this function incorrectly.[MSGCOM2] Unable to find messagehandler for class in function .

This error occurs when the named function cannot find the specified messagehandler.

This error occurs when a messagehandler canít be deleted (such as when a binary image is loaded).

No primary messagehandler attached to the objectís classes matched the name of the message.

The number of message arguments was inappropriate for one of the applicable messagehandlers.

This error occurs when an attempt is made to change the value of a readonly slot.

The named function operates on the active instance of a message and thus can only be called by messagehandlers.

The named function operates on the active instance of a message and can only handle instances of userdefined classes (not primitive type objects).

A subclass which inherits private slots from a superclass may not access those slots using the ?self variable. This error can also occur when a superclass tries to access via dynamicput or dynamicget a private slot in a subclass.

Allowed messagehandler types include primary, before, after, and around.

This error occurs when an attempt is made to delete a messagehandler attached to a class for which any of the messagehandlers are executing.

No shadowed messagehandler is available when the function callnexthandler or overridenexthandler is called.

This error occurs when the named function cannot find the specified instance.

This error occurs when a static reference to a slot in a superclass by a messagehandler attached to that superclass is incorrectly applied to an instance of a subclass which redefines that slot. Static slot references always refer to the slot defined in the class to which the messagehandler is attached.

A messagehandler can only be attached to an existing class.

No messagehandlers for a class can be loaded while any current messagehandlers attached to the class are executing.

There are three primary messagehandlers attached to the class USER which cannot be modified: init, delete and print.

Direct slot references are allowed only within messagehandler bodies.

?self is a reserved parameter for the active instance.

The symbol following the ?self: reference must be a valid slot for the class.

The symbol following the ?self: reference must be a symbol.

Messagehandlers cannot be attached to the INSTANCE, INSTANCEADDRESS, or INSTANCENAME classes.

or[MULTIFUN1] Multifield index range . out of range 1.. in function

This error occurs when a multifield manipulation function is passed a single index or range of indices that does not fall within the specified range of allowed indices.

The field variable (if specified) cannot be rebound within the body of the progn$ function.

No objects of existing classes could possibly satisfy the pattern. This error usually occurs when a restriction placed on the isa attribute is incompatible with slot restrictions before it in the pattern.

No objects of existing classes could possibly satisfy the pattern. This error occurs when the constraints for a slot as given in the defclass(es) are incompatible with the constraints imposed by the pattern.

Only one restriction per attribute is allowed per object pattern.

Object patterns are applicable only to classes of objects which are already defined.

This error pinpoints other evaluation errors associated with evaluating an expression within the object pattern network. The specific pattern and field of the problem rules are identified.[PATTERN1] The symbol has special meaning and may not be used as a .

Certain keywords have special meaning to CLIPS and may not be used in situations that would cause an ambiguity.

Single and multifield variable constraints cannot be mixed in a field constraint (this restriction does not include variables passed to functions with the predicate or return value constraints).

In a CLIPS configuration without deffunctions and/or generic functions, an attempt was made to call a deffunction or generic function from a binary image generated by the bsave command.[PRCCODE2] Functions without a return value are illegal as arguments.

An evaluation error occurred while examining the arguments for a deffunction, generic function or message.

Local variables in the actions of a deffunction, method, messagehandler, or defrule must reference parameters, variables bound within the actions with the bind function, or variables bound on the LHS of a rule.

This error occurs when the actions of a rule, deffunction, generic function method or messagehandler are prematurely aborted due to an error.[PRCCODE5] Variable unbound [in ].

This error occurs when local variables in the actions of a deffunction, method, messagehandler, or defrule becomes unbound during execution as a result of calling the bind function with no arguments.

An evaluation error occurred while examining the arguments for a deffunction, generic function method or messagehandler.

Deffunction, method or messagehandler parameter names must be unique.

A wildcard parameter for a deffunction, method or messagehandler must be the last parameter.

The special variable ?count cannot be rebound within the body of the loopforcount function.

or[PRCDRPSR2] The break function is not valid in this context.

The return and break functions can only be used within certain contexts (e.g. the break function can only be used within a while loop and certain instance set query functions).

A case may be specified only once in a switch statement.

This error occurs when CLIPS cannot find the named item (check for typos).[PRNTUTIL2] Syntax Error: Check appropriate syntax for

This error occurs when the appropriate syntax is not used.

This error indicates an internal problem within CLIPS (which may have been caused by user defined function s or other user code). If the problem cannot be located within user defined code, then the should be reported.[PRNTUTIL4] Unable to delete

This error occurs when CLIPS cannot delete the named item (e.g. a construct might be in use). One example which will cause this error is an attempt to delete a deffunction or generic function which is used in another construct (such as the RHS of a defrule or a defaultdynamic facet of a defclass slot).[PRNTUTIL5] The has already been parsed.

This error occurs when CLIPS has already parsed an attribute or declaration.[PRNTUTIL6] Local variables cannot be accessed by .

This error occurs when a local variable is used by a function or construct that cannot use global variables.

This error occurs when a function attempts to divide by zero.

This error results because «Hello» is not recognized as a valid router name.

or[RULECSTR1] Variable in CE # field # has constraint conflicts which make the pattern unmatchable.

or[RULECSTR1] CE # slot has constraint conflicts which make the pattern unmatchable.

or[RULECSTR1] CE # field # has constraint conflicts which make the pattern unmatchable.

This error occurs when slot value constraints (such as allowed types) prevents any value from matching the slot constraint for a pattern.

This error occurs when previous variable bindings and constraints prevent a variable from containing a value which satisfies the type constraints for one of a functionís parameters.

This error occurs when previous variable bindings and constraints prevent a variable from containing a value which satisfies the type constraints for one of a functionís parameters.

Logical CEs can be placed outside, but not inside, a not/exists/forall CE.

This is an illegal operation and results in an error message.

If logical CEs are used, then the first CE must be a logical CE.

Logical CEs found within a rule must be contiguous.

or[STRNGFUN1] Function eval does not work in run time modules.

The build and eval functions do not work in run time modules because the code required for parsing is not available.[STRNGFUN2] Some variables could not be accessed by the eval function.

Local variables cannot be accessed by the eval function.

This message occurs if the f option is used when executing CLIPS, but no arguments are provided.

This error occurs when the external textprocessing system cannot open the specified help file, e.g., the file cannot be found or the CLIPS process does not have sufficient privileges to read the file.

This error occurs when the external textprocessing system command fetch encounters an error when loading a file.

The slot name supplied does not correspond to a slot name defined in the corresponding deftemplate

If a slot definition is specified in a template pattern or fact, the contents of the slot must be capable of matching against or evaluating to a single value.

Fact indexes may only be used with the modify and duplicate commands when the command is issued from the toplevel command prompt.

A multifield value cannot be stored in a single field slot.

The (default ?NONE) attribute requires that a slot value be supplied whenever a new fact is created.

Источник

Понравилась статья? Поделить с друзьями:
  • Prl ошибка занотти рефрижератор
  • Privileged instruction как исправить ошибку
  • Privileged instruction victoria как исправить
  • Print error stack python
  • Privileged instruction error