Fork me on GitHub
#asami
<
2022-04-15
>
borkdude15:04:30

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?

refset16:04:29

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

quoll18:04:39

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
quoll18:04:08

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

quoll18:04:12

Asami doesn't have those