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?

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?

Best regards,

Noel Huebers

***CODE***

(defrule modpro ; counter erhöhen
    (and
        (EContext
            (studentname ?s)
            (action "bewertet")
            (value ?v)
            (task ?t))
        ?pro <- (procounter
            (name ?s)
            (task ?t)
            (val ?v)
            (count ?x))
    )
=>
(modify ?pro
    (count (+ ?x 1))) ;increase counter
(printout t "Counter für " ?s ?t ?v " erhöhen!!!" crlf))

Reply via email to