clara

http://www.clara-rules.org/
misha 2019-06-26T19:00:55.002300Z

why do rules have to have fact-type? e.g. Person here:

[?person <- Person (= first-name "Alice") (= ?last-name last-name)]
;; or here
[Person (= ?name1 name) (= ?age1 age)]

misha 2019-06-26T19:05:32.004100Z

how does engine implementation leverages that? it seems like having datomic-like datalog api would be somewhat more uniform or convenient, or ...?

2019-06-26T20:07:56.007Z

@misha in essence Clara, given facts, finds the types that match that fact and looks up the rules with conditions on that type. Note that “matching the type” includes conditions matching on an ancestor of the fact’s type.

2019-06-26T20:09:27.008900Z

This improves performance when there are lots of rules - a fact doesn’t have to be evaluated against rules that its’ type won’t allow it to match

2019-06-26T20:10:00.009500Z

There’s some tangentially related discussion of this at http://www.clara-rules.org/docs/fact_type_fn_perf/

1👌
2019-06-26T20:36:04.010500Z

@misha also, there are alternatives to how you could structure a DSL over this - Clara just has this one as the default. It isn’t necessarily trivial to extend things, but there are examples of at least datom-like datom support with https://github.com/clyfe/clara-eav

1👍