RE: Taxonomic reasoning
"Young, David" <[email protected]> Fri, 9 Sep 2005 13:46:55 -0400
| Newsgroups | gmane.lisp.lisa.general |
|---|---|
| Message-ID | <A24502FBD4FB85468D5781CD84213E40015B9876@mail01.bhusa.bhsoftware.com> |
Ok, here's what happens when I run this example, using clisp: CL-USER> (in-package :lisa-user) #<PACKAGE LISA-USER> LISA-USER> (consider-taxonomy) T LISA-USER> (setf (consider-taxonomy) nil) NIL LISA-USER> (consider-taxonomy) NIL LISA-USER> (defclass mysuper () ()) #<STANDARD-CLASS MYSUPER> LISA-USER> (defclass mysub (mysuper) ()) #<STANDARD-CLASS MYSUB> LISA-USER> (defrule match-mysuper () (mysuper) => (format t "match-mysuper~%")) #<RULE MATCH-MYSUPER> LISA-USER> (defrule match-mysub () (mysub) => (format t "match-mysub~%")) #<RULE MATCH-MYSUB> LISA-USER> (reset) T LISA-USER> (assert ((make-instance 'my-super))) ; Evaluation aborted LISA-USER> (assert ((make-instance 'mysuper))) #<FACT F-1, MYSUPER, CF is 0.000> LISA-USER> (assert ((make-instance 'mysub))) #<FACT F-2, MYSUB, CF is 0.000> LISA-USER> (run) match-mysuper match-mysub 2 LISA-USER> -----Original Message----- From: Young, David [mailto:[email protected]] Sent: Friday, September 09, 2005 12:40 PM To: 'Paolo Amoroso'; LISA Subject: RE: [Lisa-users] Taxonomic reasoning Just glancing at this code, it should do as you (and I) expect. There shouldn't be any surprises here. I'll take a look when I have a moment... dey -----Original Message----- From: Paolo Amoroso [mailto:[email protected]] Sent: Friday, September 09, 2005 12:25 PM To: LISA Subject: [Lisa-users] Taxonomic reasoning 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 _______________________________________________ Lisa-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lisa-users This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ------------------------------------------------------- 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 _______________________________________________ Lisa-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lisa-users This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ------------------------------------------------------- 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