Fork me on GitHub

Next thing, still trying to make a mental map of IDs in Asami. Always worried I’m asking too dumb questions, so please tell me to go read whatever or something if that’s the case 🙂 My testcase:

(def test-data-9 [{:db/ident :id/a-100 :name "my name" :type "something"}
                    {:db/ident :id/a-101 :name "second name" :type "something" :likes :id/a-100}])
  (def transact-info @(d/transact conn {:tx-data test-data-9}))
  (tap> (d/export-data conn))

  (d/q '[:find ?node101 ?node100 ?name :where [?node101 :likes ?node100] [?node101 :name ?name]  ] conn)


The query gives:

[:a/node-26957 :id/a-100 "second name"]


And my question - why do I get the node ID and why do I get the :id ? I would naively assume it would pick the same attribute. 🙂

Jakub Holý (HolyJak)20:07:29

Well, it looks like the value in :likes :id/a-100 ins not interpreted as an ID referring to another entity but just as a keyword. I think you would need either {:db/ident :id/a-100} or [:db/ident :id/a-100] , do not remember now.


I had somehow managed to not pick up on how to create relationships correctly. Thanks again, you got it right 🙂