This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-08
Channels
- # announcements (5)
- # babashka (46)
- # beginners (206)
- # boot (1)
- # bristol-clojurians (1)
- # calva (9)
- # chlorine-clover (27)
- # cider (1)
- # clara (10)
- # clj-kondo (105)
- # cljsrn (2)
- # clojars (1)
- # clojure (104)
- # clojure-europe (6)
- # clojure-nl (2)
- # clojure-uk (18)
- # clojurescript (44)
- # conjure (10)
- # core-async (34)
- # cursive (28)
- # data-science (6)
- # datomic (14)
- # emacs (44)
- # events (1)
- # figwheel-main (1)
- # fulcro (13)
- # graphql (9)
- # helix (12)
- # kaocha (2)
- # meander (4)
- # off-topic (2)
- # pathom (1)
- # quil (1)
- # re-frame (21)
- # shadow-cljs (49)
- # spacemacs (6)
- # xtdb (8)
Ok looking at this, I would say that clara.rules/query(https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules.cljc#L47-L57) could use a bit of validation on the args. As the user provides both the query and key/values to query already it should be pretty straight forward to determine if the map of arguments match that of the params on the query itself. similar to how we validate that the query is in rulebase today: https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules/engine.cljc#L1976 a disjunction between the keys of the params provided and params on the node itself(https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules/engine.cljc#L432) in the event that the user provided more/less the query behaves quite differently as demonstrated in the examples provided. This simply comes down to the implementation of query itself: https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules/engine.cljc#L1978
so the assumption i mentioned above is technically true, and has to be true as it would be inforced by the behavior of the memory
I have logged: https://github.com/cerner/clara-rules/issues/454 for the conversation above. Please feel free to add Comments/Concerns, it seems pretty straight forward and if i get time this weekend i might knock it out
I'm not completely sure I understand everything you said. Can I only use =
in query constraints?
in the context of the query
(= ?x x)
is defining a binding of :?x
, when querying the memory of a session the bindings of the query denoted by the query parameters are used.
meaning a defquery like:
(defquery some-query
[:?x]
[?a <- SomeFact (= ?x x) (= ?y y)])
would use:
{:?x <val>}
to retrieve the values of the query from the session.