clara

http://www.clara-rules.org/
ethanc 2018-10-26T15:52:50.003Z

@jvtrigueros that is correct, the parameter of the query should be :?last-name, and would work similar to a filter on the ?last-name binding in the lhs of the query. Where did you find that example, it should probably be updated?

✅ 1
2018-10-26T16:07:05.003700Z

Sweet! Thanks 🙂

eraserhd 2018-10-26T17:52:15.005Z

I'm curious about a number of Clara's language restrictions. For example, not being able to use :and inside not, not being able to use :and on the rhs of an accumulator.

eraserhd 2018-10-26T17:53:03.005500Z

Are these technical limitations of the underlying matching engine, or front-end limitations?

zylox 2018-10-26T17:58:34.006700Z

ya that one is a tangled web of very complicated issues...let me see if i can find the logged issues on them because there is a lot of good conversation on them

zylox 2018-10-26T18:02:31.007600Z

https://github.com/cerner/clara-rules/issues/373 this is one of them

zylox 2018-10-26T18:02:45.008100Z

has a lot of references to other issues

2018-10-26T18:03:40.009300Z

Yep @zylox has a good point on the issues around the complexities.

2018-10-26T18:05:37.010200Z

In general negated conjunctions and rete have complexities due to the structure of the network

2018-10-26T18:07:54.010800Z

Most of the times if things get weird in a rule doing this stuff I think you can typically just break the logic up across more rules to keep the structures simpler

eraserhd 2018-10-26T18:52:00.013Z

How cheap are intermediate facts? I mean, clojure records themselves are cheap, but is memory used by facts interesting? They are alpha-pruned, I assume.

eraserhd 2018-10-26T18:53:44.015400Z

The idea of a NegatedCondition, for example, is that going to be more memory. (Also, I’m not sure how that could work, because it would need to join on a variable number of bindings.)

2018-10-26T19:13:20.016Z

@eraserhd they aren’t much overhead beyond the fact object itself

2018-10-26T19:14:13.017100Z

You can make a rule that does the conjunction and inserts a fact if it is true. Then a rule with a negation on that fact. Clara actually sometimes automatically does something similar to that.

2018-10-26T19:15:29.019100Z

Intermediate facts in memory are about the same as just making a new record of whatever is what I meant. Cpu timewise just depends on what it interacts with. The actual working memory insert and retract operations are pretty fast (optimized it quite a bit)

2018-10-26T19:15:44.019600Z

Not sure if that addresses all your questions there

eraserhd 2018-10-26T19:15:57.019800Z

I think so.

2018-10-26T19:32:31.021Z

When writing rules I typically go pretty heavy on intermediate facts

2018-10-26T19:33:09.022100Z

With preference on making simple rules that models smaller concepts at a time and then compose them together for main outcome models for query. If that makes any sense.

zylox 2018-10-26T19:36:38.023300Z

same here

jimbob 2018-10-26T20:06:44.024400Z

what if i have three rules that act on type A and they all output type B while “mutating” some state in the fact. will the final fact be type B with all the “mutations”?

zylox 2018-10-26T20:12:40.024700Z

any time you mutate a fact in the rules network youve opened pandoras box

zylox 2018-10-26T20:13:00.025100Z

if you mean creating new intermediate facts, you will have 3 B facts at the end

zylox 2018-10-26T20:13:24.025500Z

but the foundation of the rules network is immutability.

zylox 2018-10-26T20:14:33.026600Z

you could have a rule that pulls in those 3 B facts (probably with an accumulator), and inserts a FinalB fact that has their combined state. ive seen this pattern used to solve a number of things

💯 3