Jess treats classes and interfaces the same. Template inheritance
models a single-inheritance tree, and each object can be in working
memory just once, so there's no way to create multiple different trees
of templates to match the same set of facts.
The basic idea of what you've shown below should work fine; is there a
specific problem with it that I can help you with?
On Nov 3, 2009, at 8:40 AM, Joao Carlos Mourao wrote:
Hello,
I'm having some problems to use interfaces in Jess. I had make a
search
in the mailing list, and although there were some messages over the
topic, i still was not able to really understand how the process
works.
The problem is basic: I have a set of classes C, and a respective
set of
interfaces I. I'm creating objects of classes C and adding to the
working memory. I would like use the interfaces I to access this
objects
(in Jess). How?
Solutions:
a) should i declare the classes, and work with the classes, leaving
the interfaces behind;
b) declare the interfaces as (deftemplate I_name (declare
(from-class C_name)); Doesn't work, because when i try to match in a
rule, I_name is not the same as C_name, then Jess don't match
c) have a combination of declarations of interfaces and classes,
like Russ did in a previous message
"r.eval("(defclass IInterface1 IInterface1)");
r.eval("(defclass IInterface2 IInterface2 extends
IInterface1)");
r.eval("(defclass AbstractClassA AbstractClassA extends
IInterface2)");
r.eval("(defclass ClassB ClassB extends
AbstractClassA)");
r.eval("(defclass ClassC ClassC extends
AbstractClassA)");
r.eval("(defclass ClassD ClassD extends
IInterface2)");"
, which i have tried but haven't worked.
Any ideas?
Joao
-unclassified
------------------------------------------------------------------------------------------------------------
Disclaimer:
If you are not the intended recipient of this email, please notify
the sender and delete it.
Any unauthorized copying, disclosure or distribution of this email
or its attachment(s) is forbidden.
Thales Nederland BV will not accept liability for any damage caused
by this email or its attachment(s).
Thales Nederland BV is seated in Hengelo and is registered at the
Chamber of Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------
<joao.mourao.vcf>
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012 [email protected]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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].
--------------------------------------------------------------------