replikativ / datahike

A fast, immutable, distributed & compositional Datalog engine for everyone.
https://datahike.io
Eclipse Public License 1.0
1.62k stars 95 forks source link

Make history, as-of and since composable #682

Closed jonasseglare closed 1 month ago

jonasseglare commented 2 months ago

Describe the feature you would like to request

Currently the following three queries all produce an error:

(d/q '[:find ?a :in $ ?e :where [?e :age ?a]]
                        (-> @conn d/history d/history)
                        [:name "Alice"])

(d/q '[:find ?a :in $ ?e :where [?e :age ?a]]
                    (-> @conn
                        (d/as-of tx-id0)
                        d/history)
                    [:name "Alice"])

(d/q '[:find ?a :in $ ?e :where [?e :age ?a]]
                    (-> @conn
                        d/history
                        (d/as-of tx-id0))
                    [:name "Alice"])

The error is the following:

error: java.lang.IllegalArgumentException: No implementation of method: :-slice of protocol: #'datahike.index.interface/IIndex found for class: nil

Describe the solution you would like

I would like to make queries against database expressions such as (-> @conn d/history d/history), (-> @conn (d/as-of tx-id0) d/history) where we compose calls to d/history, d/as-of and d/since.

Describe alternatives you've considered

Datomic, where this is possible (at least to some extent).