Hello List,

as a total Jess novice (but rather experienced Java programmer), I feel a little embarassed to ask so fundamental questions like the following one.

I have a simple Java class called "Course" with three private final int attributes and the corresponding get-methods. I instantiated three objects from this class and want to add these Objects as Facts to the working memory of Jess so that I can access the attributes (and mathods) of the objects as slots of the facts. Using r.defclass(Course, Course, null) -(r is my Rete Object)- resulted in an error - the class Course wasn't found.

Instead, I used something like this:
           Fact f1 = new Fact("course", r);
           f1.setSlotValue("crn", new Value(new Integer(1)));
           f1.setSlotValue("starttime", new Value(new Integer(1110)));
           f1.setSlotValue("endtime", new Value(new Integer(1230)));
           r.assertFact(f1);
(crn, starttime and endtime or the private final int attributes).

This allowed me to assert the course as a fact. But... is there no way to do this, say, a little more stream-lined?

Also, I wonder how I can define a rule from Java in Jess that allows me to check whether or not two facts have the same content in a slot and, iff true, do something. r.eval("(defrule r1 (forall (course (starttime ?time))) => (printout t \"Warining! Time collision!\" crlf))"); Did not work, as it terminated with an ArrayIndexOutOfBounceException at Index 4.

I am really sorry to ask these very basic questions. However, I coulnd't find answers in the manual-homepage, the wiki or the list archive.

Thank you for your help,

Bastian

--------------------------------------------------------------------
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