Functions for working with datomic queries