Title: Testing Inheritance of defclasses in Jess5.0a1

I am running to a problem when I use the defclass inheritance feature.
Below is a detailed description of a simple testcase that demonstrates
the problem.

Working Memory(WM) Contents:
        The WM has one instance of "Document" class. This class is a subclass
        of "BeanElement" and has one data member called "submissionNum".
        The data member "submissionNum"  can be accessed by "getSubmissionNum"

        accessor method.

The Rule Program:
        (defclass beanElement BeanElement)
        (defclass document Document extends beanElement)

        (defrule r1
        ?document <- (document)    
        =>
        (assert (feedbackGoal ?document))
        )

        (defrule r2
        (feedbackGoal ?document)
        =>
        (printout t "************" crlf)
        (printout t (call ?document getSubmissionNum))
        )

        ;an alternative rule to "r1" which makes the rule porgam work.
        ;(defrule r11
        ; (beanElement (class ?class1) (OBJECT ?document))
        ; (test (= (str-compare (call ?class1 getName) "Document") 0))
        ;  =>
        ; (assert (feedbackGoal ?document))
        ; )
 
Problem:
        The program terminates when it tries to execute
                          (call ?document getSubmissionNum)
         in "r2" RHS by throwing a ReteException with the message
                 "Not an external address: <Fact-1> type = 16 at line 0:( run ).

Workaround:
        Replace rule "r1" with "r11".

Thanks for your attention.

Dariush Navabi
AVNET CMG
Phoenix AZ

Reply via email to