clara

http://www.clara-rules.org/
hadils 2019-08-07T14:04:25.015100Z

Thanks @mikerod ! I am creating an empty session at this point. That seems to resolve these errors.

2019-08-07T14:24:04.015700Z

Hmm. Interesting. Well feel free to ask if you have more questions.

sparkofreason 2019-08-07T20:29:41.017100Z

If the only thing that changes in the LHS of a rule is an accumulator value, is it correct that the rule won't fire if the collection of facts matching the accumulator condition change?

ethanc 2019-08-07T20:35:52.019Z

I would think that if an accumulator saw a new value, and the previously accumulated objects changed that there would be work that the rhs would have to do. Though I might be misunderstanding your question

sparkofreason 2019-08-07T20:36:54.019700Z

That's how I want it to behave, but I have a distant recollection that it doesn't actually work that way. Been awhile since I've played with clara.

ProbablyJody 2019-08-07T20:42:29.022200Z

@dave.dixon, are you thinking of the retract-fn’s behavior?

sparkofreason 2019-08-07T20:42:47.022400Z

Could be. Possible I'm just writing my accumulation clause wrong or something, because sometimes it does seem to behave as you described.

2019-08-07T21:22:57.025200Z

@dave.dixon in current version of Clara (and several before) the rule will not continue to propagate if the accumulated value hasn’t changed according to = See lines like https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules/engine.cljc#L1200

2019-08-07T21:24:34.027700Z

So specifically if the accumulators result from the :convert-return-fn is = to what it was in the previous round of accumulating fact matches, propagation stops - which would imply no RHS action being triggered/activated

2019-08-07T21:25:58.028600Z

The tests near what Jody pointed too could be enlightening on some more semantics though. I agree

2019-08-07T21:26:21.029400Z

There are quite detailed github issues out there that also discuss these semantics when we added the related changes.

sparkofreason 2019-08-07T21:48:20.030700Z

@mikerod Thanks. Not exactly sure what I was thinking of. My actual problem was that I was hacking at something trying to make it update in place rather than letting truth maintenance do the lifting. Need to get back to "thinking TMS" 😉

2019-08-07T21:52:06.031200Z

Yes. No mutate in place. That’ll indeed cause issues.