;; the following *RB* has a rule (the first) that illustrates the ;; syntax of instance clauses, test clauses and negative ;; clauses. The first negative clause (which is commented out) ;; was put there as a negative clause which (given the *OB*) ;; should definitely match a signal object and thereby block the ;; rule from firing. On the RHS, the rule illustrates the ;; modify-instance and make-RBR-instance functions as well as ;; a call to regular Lisp (the format call) ( load-all-rules '((defrule move-train-1 (train ?train place ?train-pos in-motion yes name ?name) (signal ?signal place ?signal-pos color green) (test (= ?signal-pos (1+ ?train-pos))) ;(is-no (signal ?signal ) (test t)) (is-no (train ?train2 place ?train-pos2)(test (eql ?train-pos2 ?signal-pos))) --> (modify-instance ?train 'place ?signal-pos) (modify-instance ?signal 'color ''red) (make-RBR-instance 'train :place 10 :in-motion 'yes :name 1 ) (format t "~%Train ~s moving to position ~s" ?name ?signal-pos) ) (defrule move-train-2 (train ?train place ?train-pos in-motion no) (signal ?signal place ?signal-pos color green) (test (= ?signal-pos (1+ ?train-pos))) --> (format t "~~%Tell Engineer to Move to ~s" ?signal-pos)) (defrule move-train-3 (train ?train place ?train-pos in-motion yes) (signal ?signal place ?signal-pos color red) (test (= ?signal-pos (1+ ?train-pos))) --> (format t "~~%WARNING STOP AT ~s" ?signal-pos))))