Fork me on GitHub

Asami 1.1.0 is now out. This has minor updates: • Entity arrays are now returned as vectors and not lists. • Entities now represent multi-arity attributes as a set of values. If more than one of an attribute is found, then a set of those values is returned in the entity. Similarly, providing a set will result in using the attribute multiple times in the graph. • Arrays in entities can be appended to by using the + annotation on attributes (see for details) • Queries now accept _ symbols as wildcards, and accept shortened constraints (not just triples)


It's mentioned in the docs that :db/ident can be any data type, but I'm not having luck getting it to work with vectors as idents. Is it actually any scalar data type?


Yes. Though for the in-memory indices I’m surprised that it’s not working


(def tx (d/transact conn {:tx-data [{:db/ident ["liz" 5] :name "Elizabeth"}]}))

(d/q '[:find [?n ...]
       :where [?p :name ?n] [?p :db/ident ["liz" 5]]] (d/db conn))

(d/entity (d/db conn) ["liz" 5])

(d/q '[:find ?p
       :where [?p :name ?n] [?p :db/ident ["liz" 5]]] (d/db conn))
yeah the 3 queries here and entity call return nil


Oh, of course! It deconstructed it into a list!


I could make it ignore that on ident


cljs.user=> (def tx (d/transact conn {:tx-data [{:db/ident ["liz" 5] :name "Elizabeth"}]}))
cljs.user=> (pprint (:tx-data @tx))
([:tg/node-5 :tg/entity true 3 true]
 [:tg/node-5 :db/ident :tg/node-6 3 true]
 [:tg/node-6 :tg/first "liz" 3 true]
 [:tg/node-6 :tg/rest :tg/node-7 3 true]
 [:tg/node-7 :tg/first 5 3 true]
 [:tg/node-6 :tg/contains "liz" 3 true]
 [:tg/node-6 :tg/contains 5 3 true]
 [:tg/node-5 :name "Elizabeth" 3 true])


so the ident became :tg/node-6


That won’t work on buffer-backed indexes, but I think I can do it as a new datatype with edn


(I have no opinion on if it's a good idea or not, just starting to play with asami a little bit 🙂 )


It’s an edge case that ought to be handled. Either accept it, or throw an exception. Either way, it shouldn’t get serialized into a linked list like that, since it isn’t useful (and led to confusion with at least one person)


I made a Zuko ticket for it