Fork me on GitHub
#clara
<
2018-02-01
>
tcarls00:02:22

@dadair, same ns, called from the -main function with :cache false. The get-warnings rule is basically as simple as the above implies -- it just retrieves every single record we have of type Warning with no filters/joins/etc: (r/defquery get-warnings [] [?warning <- Warning])

tcarls00:02:16

Hmm. Unrelated issue, but I have a theory on why I'm getting more fact insertions than I expected. Looking through the explain output...

{:ns-name pdfsort.core,
   :lhs
   [{:type pdfsort.types.Document,
     :constraints [(= ?type (or name-type header-type))],
     :fact-binding :?doc}],
   :rhs (do (r/insert! (->DocumentType ?doc ?type))),
   :name "pdfsort.core/use-document-type"}
I expected the (or name-type header-type) to mean that we bind the first non-falsey item of name-type or header-type to ?type, but it looks like it actually results in both paths being followed. Changing it to (if name-type name-type header-type) results in the initially-expected behavior, of performing one DocumentType insertion per Document.

wparker15:02:05

@U2V9F98N8 I’d expect the or in the above rule to be short-circuiting i.e. just clojure.core/or. Something like this is a Clara-specific non-short-circuiting or:

[:or [DocumentType1] [DocumentType2]] 
but that doesn’t apply to the case you describe; note the keyword :or not the function invocation of “or”. If you can create a reproducing case it would be helpful if you could log a GitHub issue - tbh I suspect something else is going on, but you never know