asami

borkdude 2022-04-15T15:52:30.906789Z

I'm trying asami to store var information and then query it transitively, but I don't know what's the best way to store the data. E.g. given this:

(def data [{:entity/type :call
            :var/name 'assoc
            :var/ns 'clojure.core
            :from/var 'foo
            :from/ns 'example}

           {:entity/type :call
            :var/name 'foo
            :var/ns 'example
            :from/var 'bar
            :from/ns 'example}])
You can see that a call was made to clojure.core/assoc from the var example/foo. And there was a call from example/bar to example/foo. So transitively example/bar was calling clojure.core/assoc too. How could I accomplish this with asami? Any ideas?

refset 2022-04-15T16:27:29.585319Z

This is for XT's Datalog, not Asami's, but sharing just in case this snippet is helpful/illustrative: https://gist.github.com/refset/57a910e2b746332ec7a0a31886f57cfb

quoll 2022-04-15T18:16:39.224499Z

I was explaining in a DM that rules were needed here, since there is no attribute to be transitive over. My thoughts were either: • use a production rule that creates an attribute to create the connections, which can then be traversed transitively • use a rules system like Datomic's which can make those connections without having to materialize them

👍 1
quoll 2022-04-15T18:18:08.306119Z

For anyone looking on, the rules that @taylor.jeremydavid shows are the Datomic-style that I was referring to in the second suggestion

quoll 2022-04-15T18:18:12.940259Z

Asami doesn't have those

quoll 2022-04-15T18:18:24.280739Z

(sigh)