On Aug 14, 2007, at 5:20 AM, Noël Huebers wrote:

Hi,

I'm new to the Jess language and have some questions.

1. I work with Java object. I stored them in Jess with store and assert/fetch commands. But I could not call there member in the lhs of my rule. No function calls allowed, right? So, for every object I made a rule to insert a Jess template. This works fine, but is this way of mapping Java objects to Jess facts and then discarding the object the best way to work with java objects?


I'm afraid I don't quite understand what you're asking. If you're pointing out that in Jess, you have to add objects to working memory ("insert a Jess template") before rules can act directly on them, then yes, that's correct. I'm not sure what you mean about discarding something.


2. I am trying to implement a counter-logic for specific slot combinations. First, everytime a fact is inserted I check if there is already a procounter fact. If not I create one. This works fine. The next rule should recognize when a fact (EContext) is inserted and the counter (procounter) already exists. In this case, the count slot should only be modified. I try to compare bounded vars ? s ?v ?t from EContext to procounter slots, but I think Jess simply overwrites the binding. Can you help me with the correct syntax? Is there a better logic to implement a counter?


What you've shown looks correct; you probably want to include a "(declare (no-loop TRUE))" to the rule to avoid an infinite loop.

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
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]
--------------------------------------------------------------------

Reply via email to