This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-13
Channels
- # atlanta-clojurians (1)
- # beginners (148)
- # boot (13)
- # capetown (1)
- # cider (38)
- # cljs-dev (92)
- # clojure (61)
- # clojure-brasil (1)
- # clojure-dev (6)
- # clojure-italy (21)
- # clojure-losangeles (1)
- # clojure-nl (7)
- # clojure-norway (20)
- # clojure-spec (70)
- # clojure-uk (64)
- # clojurescript (69)
- # core-async (11)
- # cursive (6)
- # data-science (2)
- # datomic (50)
- # docker (2)
- # duct (12)
- # figwheel (1)
- # fulcro (81)
- # graphql (19)
- # jobs (3)
- # jobs-discuss (44)
- # keechma (1)
- # leiningen (1)
- # mount (2)
- # off-topic (10)
- # onyx (19)
- # parinfer (3)
- # portkey (6)
- # re-frame (4)
- # reagent (145)
- # reitit (1)
- # ring (1)
- # ring-swagger (2)
- # specter (1)
- # sql (4)
- # tools-deps (43)
- # unrepl (29)
- # vim (1)
another question: what is a good way to debug datalog query rules? I find it quite hard to diagnose & fix mistakes in them.
@chrisblom are you referring to datalog query performance? https://github.com/Datomic/day-of-datomic/blob/master/tutorial/decomposing_a_query.clj
What kind of problems are you running into? I often find that I have to separately break up the group of clauses to confirm I have exactly what I am after. I am just curious if you are having a different problem debugging rules.
i’m developing some rules for an authorisation scheme, i have a rule
[[check-permission ?p ?action ?resource]
[?p :permission/action ?action]
[?p :permission/resource ?resource]]
which can be used to check if a permission is granted to perform an action on some resource
where actions are a fixes set of idents, like :action/read, :action/update, action/delete
such that when a permission grants :action/ANY on a resources, check-permission will match any action
i’ve tried adding
[[check-permission ?p _ ?resource]
[?p :permission/resource ?resource]
[?p :permission/action :action/ANY]]
but it does not worki’ve also tried a bunch of other rules, but as the rules engine is a black box, i have no idea when a rule matches or not
i would try something like
[[check-permission ?p ?action ?resource]
[?p :permission/resource ?resource]
[(= ?action :action/ANY]]
thanks, but thats not what i’m looking for. I’m looking for a rule such that [check-permission ?p ?action ?resource]
will match when ?action is :action/read | :action/write | :action/…
provided that
{:db/id ?p
:permission/resource ?resource
:permission/action :action/ANY}
so when a permission has :permission/action :action/ANY
it should not unify the ?action variable of check-permission, but i’m not able to achieve this
[[check-permission ?p ?action ?resource]
(or [?p :permisison/action :action/ANY]
[?p :permission/action ?action])
[?p :permission/resource ?resource]]
ok, seems logical, but datomic does not allow it
Assert failed: All clauses in 'or' must use same set of vars, had
[#{?p} #{?action ?p}] (apply = uvs)
[[check-permission ?p ?action ?resource]
[?p :permission/action ?action]
[?p :permission/resource ?resource]]
[[check-permission ?p ?action ?resource]
[?p :permission/action :action/ANY]
[?p :permission/resource ?resource]]
fyi, an or-join is also possible:
'[[check-permission ?p ?action ?resource]
(or-join [?p ?action]
[?p :permission/action :action/ANY]
[?p :permission/action ?action])
[?p :permission/resource ?resource]]
anyway, the grammar does say that a rule head is [rule-name rule-vars] , rule vars is [variable+ | ([variable+] variable*)] and variable is symbol starting with ?
can i file a bug for this? It kept me busy for a few hours and i’d like to avoid others from experiencing the same.
Looks like a deps conflict @donmullen