The short answer: yes, this is how it works. Your function will be
called both to check for new matches, and to confirm old ones, and
Jess may or may not memoize the results so that your function may not
be called when you think it might. You can't use a method whose return
value varies over time this way, or your system will quickly become
inconsistent, for the same reasons that a Java Comparator with a time-
varying return value could not be used to sort an array.
On Apr 24, 2009, at 7:16 AM, bohlken wrote:
> Hello all,
>
> I have defined a rule with the shadow facts TimePoint like this:
>
>
> (defrule myRule1
>
> (TimePoint (name ?name1)(OBJECT ?tp1-obj))
> (TimePoint (name ?name2)(OBJECT ?tp2-obj))
> (test (call ?*myTest* check ?tp1-obj ?tp2-obj))
> =>
> ...)
>
> *myTest* is a JAVA Object with a check function.
> Now, lets say the rule will be activated (the result of check is
> true).
>
> In my application it can happen, that the result of the check function
> becomes false, independend(!) of the facts in the rule.
>
> Now, if a fact changes, the following happens:
>
> - the check function is called with the OLD values - before the fact
> has
> changed(!) -, if the result is true, then the rule is deactivated,
> the fact
> is changed, the check function is called again, and if true, the
> rule is
> activated again
>
> - if the check function with the OLD values is false, then the rule
> will NOT
> be deactivated. The fact is changed, the check function is called
> again. It
> can again be false and the rule will NOT be deactivated.
>
> Is this a bug or a feature?
>
> Thanks,
> Wilfried
>
>
>
>
> Wilfried Bohlken
> Arbeitsbereich Kognitive Systeme
> FB Informatik
> Universitaet Hamburg
> Vogt-Koelln-Str. 30
> 22527 Hamburg
> Germany
> Tel.: +49-40-42883-2577
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users
>
you@...'
> in the BODY of a message to
majordomo@..., NOT to the list
> (use your own address!) List problems? Notify
owner-jess-users@...
> .
> --------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012
ejfried@...
Livermore, CA 94550
http://www.jessrules.com--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users
you@...'
in the BODY of a message to
majordomo@..., NOT to the list
(use your own address!) List problems? Notify
owner-jess-users@....
--------------------------------------------------------------------