Knowledgework - Lisp Symbiosis
Hi all,
I have a little problem when trying to call a lisp expression inside a
KW expression.
This is a class I've implemented:
(kw:def-kb-class facet ()
((name :accessor name)))
and this is a function to get instances of facet by comparing the value
of the instance variable "name".
(defun get-facet-obj (fct)
(kw:findall '?obj '(and (facet ?obj)
(equal (name ?obj) fct))))
I've solved the problem like iut's written below, but of course it's not
the best solution (it's to get all the object of "facet" and then
iterate with dolist and compare the instance variable with the argument
given to the function).
(defun get-facet-object (fct)
(let ((current-facet nil)
(facets-list (kw:findall '?obj '(facet ?obj))))
(dolist (current-facet facets-list nil)
(if (equal (name current-facet) fct)
(return current-facet)))))
I believe that the problem is that the call to (name ?obj) in the
get-facet-obj function does not call "name", but instead it tries to
equalize fct with the "structure" (the functor) (name ?obj) ! Of course
I'm not sure of this.
Anyone has any idea of what's happening?
thanks,
Miro.