Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

[query] Allow to bind [(min ?t) ?t0] #750

Open
ncalexan opened this issue Jun 18, 2018 · 1 comment
Open

[query] Allow to bind [(min ?t) ?t0] #750

ncalexan opened this issue Jun 18, 2018 · 1 comment
Labels
A-query Issues or requests for query capabilities.

Comments

@ncalexan
Copy link
Member

Mentat allows to order results; Datomic does not. When expressing "least or greatest in a group" style queries, the fact that we can't manipulate the max or min outside of the find spec is limiting. That is, it's not easy to ask for "the 10 most recently used items" or whatever.

I think we might be able to bind scalars to achieve this. That is, we might find that

:find
 [?e ...]
:where
 [?e :value ?v]
 [(min ?v) ?v0]
:order
 (desc ?v0)
:limit
 10

is generally useful.

@ncalexan ncalexan added the A-query Issues or requests for query capabilities. label Jun 18, 2018
@thomcc
Copy link
Contributor

thomcc commented Aug 23, 2018

Some more context in #815. I think either this or #647 are needed to do even a fairly naive top-sites list (which just finds the top N most visited urls) would need to order by count, either as a :order (desc ?numVisits) where there's a [(count ?visit) ?numVisits], or as a more direct :order (count ?visit).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-query Issues or requests for query capabilities.
Projects
None yet
Development

No branches or pull requests

2 participants