NextPrevUpTopContentsIndex

6.3.1 Example

A meta-class standard-kb-class could be defined as a KnowledgeWorks class. New KnowledgeWorks classes (or even ordinary non-KnowledgeWorks classes) could be defined with this meta-class. KnowledgeWorks could then reason about the instances of the classes and about the class objects themselves. The code below implements this:

(def-kb-class standard-kb-class (standard-class) ())
(defmethod validate-superclass 
           ((class standard-kb-class)
            (superclass standard-class))
           t)
(def-kb-class foo () ((slot))
                    (:metaclass standard-kb-class))

Then when the following rule fires:

(defrule find-kb-class :forward
  (standard-kb-class ? clos::name ?n)
  -->
  ((format t "~%I can reason about class ~s" ?n)))

it will output:

I can reason about class FOO
KnowledgeWorks and Prolog User Guide (Windows version) - 29 Feb 2008

NextPrevUpTopContentsIndex