How do you dereference a slot in a fact matched in the LHS of a rule? If a variable matches a fact, I can t find how to create further conditions that match slots within that fact.
For example, in the code below, I want to print some text if there s a fact of the form "(do (action ?action))". However, ?action is itself a fact, and I only want the rule to trigger if that fact s "name" slot is "run". How would I accomplish this?
(deftemplate do
(slot action)
)
(deftemplate action
(slot name)
)
(defrule find-do ""
?do <- (do (action ?action))
(test (eq ?action.name "run")) ; This causes a syntax error.
=>
(printout t "doing " ?action crlf)
)
(deffacts startup (do (action (action (name "running")))))