0
votes

I have the following deftemplates in CLIPS (6.3):

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

I need to read the pair (property, value) from input, and then find the fact A whose value in the slot property is value.

If I do something like this:

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

I get the following error:

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

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

What should I do now?

1

1 Answers

0
votes

You have to write to slot name in the pattern matching part of the rule.

The correct sintax is:

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

I don't understand what you want to accomplish, and I know it's late, but hope it helps.