I think Michael Fogus wrote:

Jess is more flexible than other Java rule engines you may have used,
and I think it's this flexibility that's giving you trouble here. If
you want inheritance among defclass and/or deftemplate types, you have
to set it up yourself.

(defclass object.Shape object.Shape)
(defclass object.Circle object.Circle extends object.Shape)
(defclass object.Square object.Square extends object.Shape)

Now you can write rules that match object.Shape facts, and they'll
match both Circles and Squares.

[Charset iso-8859-15 unsupported, filtering to ASCII...]
> I have theoretcial class structure of:
> 
> interface object.Shape
> 
> object.Circle implements shape
> object.Square implements shape
> 
> And I have rules:
> 
> (defrule find-square
>    (object.Square)
> =>
>    (printout t "Square" crlf)
> )
> 
> (defrule find-circle
>    (object.Circle)
> =>
>    (printout t "Circle" crlf)
> )
> 
> 
> What I'd really like to do is:
> 
> (defrule find-shape
>    ?f <-(object.Shape)=>
>    (printout t (call ?f getType) crlf) )
> 
> 
> Except that I can't seem to match on an interface.
> 
> Any help would be appreciated.
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to