clara

http://www.clara-rules.org/
schmee 2020-10-20T13:49:18.108600Z

what a good approach to ensure that a fact is only inserted once, kind of like a primary key in a DB?

schmee 2020-10-20T13:49:49.109300Z

I could have a rule where the RHS literally checks in a DB to see if the key is there, but it seems better to keep as much state as possible in the session?

PB 2020-10-22T17:25:39.119100Z

It seems kind of dangerous have side-effects inside of a rule.

nikola 2020-10-20T15:29:10.110300Z

What would be the best practice to implement a decision table like that?

nikola 2020-10-20T15:31:45.112100Z

At my team a couple of product specialists use Excel for logic like that and I was wondering if I can somehow turn them into Clara rules and use it to make decisions. Has anyone have done something similar in the past?

2020-10-20T16:20:05.112600Z

@schmee Use an accumulator for the fact you actually want 1 of

2020-10-20T16:20:10.112800Z

if you have rules that may produce multiples

2020-10-20T16:20:17.113100Z

make an intermediate fact type to represent the multiple

2020-10-20T16:20:26.113400Z

then a single acumulator to aggregate it “down to 1”

2020-10-20T16:20:46.113900Z

this aggregation rule is you explicitly choosing how you want to represent or handle multiple supporting matches

2020-10-20T16:21:14.114400Z

it’s not always obvious actually - if they happen to have different data associated with them them or something

schmee 2020-10-20T16:21:51.114700Z

gotcha, thanks for the tip!

2020-10-20T16:22:11.115600Z

@nikola.kasev I haven’t attempted anything first-class with tables like that - but you could start by just trying to make rule to represent it and see what patterns may emerge

2020-10-20T16:22:51.116600Z

I know some traditional rete-based engines - like Drools on the JVM - had some spreadsheet-like decision table functionality built on top to capture the pattern - but underneath was stilll just plain rules