Fork me on GitHub
#asami
<
2022-06-23
folcon11:06:51

So I'm curious, is this considered a bug?

(let [eg-db-uri "asami:"
      conn (asami/connect eg-db-uri)
      _ @(asami/transact conn {:tx-data [{:coord [0 0]}]})
      db (asami/db conn)]
  (asami/q
    '[:find [?e ...]
      :where
      [?e :coord [0 0]]]
    db))

#_=> ()
I'm aware you can do this:
(let [eg-db-uri "asami:"
      conn (asami/connect eg-db-uri)
      db (asami/db conn)
      new-node (zuko.node/new-node (asami/graph db))
      _ @(asami/transact conn {:tx-triples [[new-node :coord [0 0]]]})
      db (asami/db conn)]
  (asami/q
    '[:find [?e ...]
      :where
      [?e :coord [0 0]]]
    db))

#_=> (:a/node-65763)
I know it decomposes it, which is why it doesn't match and perhaps it's done for performance? However, this seems to fail the test of, I transact something in, I should be able to query it out. If there's some better way to query this that I'm missing, please tell me 😃...

quoll14:06:26

No, it's not considered a bug. The first case is (currently) explicitly supposed to decompose the array into triples, and therefore the query is guaranteed to return nothing. The only time an array is not decomposed is if the property is :db/ident or :id

folcon15:06:26

Hey @quoll, hope you're feeling better! Ok, so in which case I should probably work with triples explicitly then so I can query for stored structures.

quoll17:06:24

Just to let people know… I had a private discussion with @folcon. Didn’t want people to think that I’m ignoring the channel 🙂

🙂 1