How to store arbitrary lisp structures in/with slots?

34 views
Skip to first unread message

jmorrison

unread,
May 9, 2011, 1:01:31 PM5/9/11
to km-qa
Hi All;

Sorry if this is a dumb/newbie question (I am new both to KM as a
software package and knowledge representation as a discipline).

I would like to represent procedural knowledge in slots, for example,
in the robotics domain:

(a Sensor with
(outputs ((a Output called output0 with (type
(*Integer)))
(a Output called output1 with (type
(*Integer)))))
(rules '((whenever (t) (output output0 3))
(whenever (t) (output output1 4)))))

After the KB is loaded, I wish to collect and compile all the various
"rules" (and inputs and outputs) of the various Sensors, Actuators,
and Controllers that constitute a given robot. Is there a
straightforward way to return arbitrary lisp structure (e.g., the
quoted "rules" value above) such that I can fetch it via (km::km (the
rules of ...)) from CL? Or am I heading in the wrong direction?

Thanks in advance,

-jm

Pete

unread,
Jun 5, 2011, 3:57:46 PM6/5/11
to km-qa

John - Apologies for the slow reply. You are doing the right thing,
you just forgot an open
parenthesis before the quote -- a slot always takes a *list* of
values, not a single value:

KM> (a Sensor with
(outputs ((a Output called output0 with (type
(*Integer)))
(a Output called output1 with (type
(*Integer)))))
(rules ('((whenever (t) (output output0 3))
(whenever (t) (output output1 4))))))
(_Sensor2)

KM> (the rules of _Sensor2)
('((whenever (t) (output output0 3)) (whenever (t) (output output1
4))))

Best wishes, Pete
Reply all
Reply to author
Forward
0 new messages