Taxonomic reasoning
Paolo Amoroso <[email protected]> Fri, 09 Sep 2005 18:24:59 +0200
| Newsgroups | gmane.lisp.lisa.general |
|---|---|
| Organization | Paolo Amoroso - Milano, ITALY |
| Message-ID | <[email protected]> |
I am trying to understand how taxonomic reasoning works. Consider the following class definitions: (in-package :lisa-user) (defclass mysuper () ()) (defclass mysub (mysuper) ()) I would like to write a rule that matches only mysuper facts, and a different rule only for mysub facts, i.e. I don't want the rule for mysuper to also match mysub: (defrule match-mysuper () (mysuper) => (format t "~&Matched MYSUPER~%")) (defrule match-mysub () (mysub) => (format t "~&Matched MYSUB~%")) If I understand correctly, this should do what I want if I set consider-taxonomy to nil. But LISA works in a different way. Here is what happens with the default of t for consider-taxonomy (see my other message): LISA-USER> (reset) T LISA-USER> (assert (mysuper)) #<FACT F-1, MYSUPER, CF is 0.000> LISA-USER> (assert (mysub)) #<FACT F-2, MYSUB, CF is 0.000> LISA-USER> (run) Matched MYSUPER Matched MYSUPER Matched MYSUB 3 And here is what happens when I toggle consider-taxonomy: LISA-USER> (reset) T LISA-USER> (setf (consider-taxonomy) nil) NIL LISA-USER> (assert (mysuper)) #<FACT F-1, MYSUPER, CF is 0.000> LISA-USER> (assert (mysub)) #<FACT F-2, MYSUB, CF is 0.000> LISA-USER> (run) Matched MYSUPER Matched MYSUPER Matched MYSUB 3 LISA-USER> Setting consider-taxonomy has apparently non effect. Is this the expected behavior? Are my rules correct? If not, do I have to rewrite match-mysuper like this? It feels quite kludgey. (defrule match-mysuper () (mysuper) (not (mysub)) => (format t "~&Matched MYSUPER~%")) I am using CMUCL Snapshot 2005-09 (19B) under Linux with the latest LISA CVS sources. Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf