I was wondering if anyone has seen this before:
- I have a bunch of rules defined (example below)
- Rules 1, 3, 4, 6, & 7 all work fine
- Rules 2, 5, & 8 all fail
- The failing rules contain ‘fn-expr(s)’
- I am running on datomic cloud
- ALL rules work when running the query through the bastion (i.e. locallyi at the repl)
- I get the following exception message when running through API Gatway (i.e. in my environment):
:db.error\/invalid-rule-fn The following forms do not name predicates or fns: (* * -) {:cognitect.anomalies/category :cognitect.anomalies/incorrect, :cognitect.anomalies/message "The following forms do not name predicates or fns: (* * -)", :symbols (* * -) :db\/error :db.error\/invalid-rule-fn}```
- I have
clojure.core/*
andclojure.core/-
in the:allow
key in myion-config
- I tried using the fully qualified fn name in the rule (No luck either)
- The attribute_groups example in day of datomic cloud appears to be doing the same thing.
(https://github.com/cognitect-labs/day-of-datomic-cloud/blob/229b069cb6aff4e274d7d1a9dcddf7fc72dd89ee/tutorial/attribute_groups.clj#L28)
MY RULES BELOW:
(def sort-calcs
'[;; WORKS
[(rule-1 [?p] ?value)
[?p :q.p/t :my-val]
[?p :m.p/p ?value]]
;; FAILS
[(rule-2 [?v ?p] ?value)
[?v :f/m ?ms]
[?p :q.p/t :my-val]
[?p :m.p/rp ?r]
[?p :m.p/p ?pa]
[?p :q.p/t ?tl]
[(* ?r 0.01 ?ms) ?ra]
[(* ?tl ?pa) ?tot]
[(- ?tot ?ra) ?value]]
;; WORKS
[(rule-3 [?p] ?value)
[?p :q.p/t :my-val-2]
[?p :m.p/p ?value]]
;; WORKS
[(rule-4 [?p] ?value)
[?p :q.p/t :my-val-2]
[?p :m.p/r ?value]]
;; FAILS
[(rule-5 [?v ?p] ?value)
[?v :f/m ?ms]
[?p :q.p/t :my-val]
[?p :m.p/rp ?r]
[(* ?ms ?r 0.01) ?value]]
;; WORKS
[(rule-6 [?v] ?value)
[?v :f/sp ?value]]
;; WORKS
[[rule-7 [?v] ?value]
[?v :v/dis ?value]]
;; FAILS
[(rule-8 [?v ?p] ?value)
[?v :f/sp ?pr]
[?p :q.p/t :my-val-2]
[?p :m.p/ma ?a]
[(- ?a ?pr) ?value]]])
I could use some guidance on what to do next.