As previously mentioned, datalog/datomic both work over in-memory data and 
are excellent libraries.

You might also consider a rule engine such as Clara:

https://github.com/rbrush/clara-rules

Depending on your requirements, particularly if you need to efficiently 
match data as it changes over time as opposed to a single-shot query, then 
a rule engine may be more or less appropriate. Clara also provides a 
single-shot query feature like datalog/datomic. Clara has an extensible 
"accumulator" feature that I don't believe is available in those other 
libraries (but I could be wrong...) It allows you to reason about the 
properties of a collection of things (e.g. count, max, min, avg, etc.)

You can think of a rule as a persistent query or view - it can produce new 
results (matches) as your data changes without having to re-query the 
entire dataset. You not only get the matched data elements but if you have 
more than one rule (or query), your rules/queries are optimized to the 
extent that they share sub-expressions due to the use of a (modified) RETE 
algorithm.

Aside: Fundamentally, RETE trades increases in memory usage to speed up 
matching and like any algorithm has some worst case scenarios you need to 
be mindful of (partial matches.) The RETE graph effectively acts as a set 
of indexes into your data that are optimized specifically for your 
rules/queries.

Also, Clara has built-in truth maintenance features that may be beneficial 
to your situation. YMMV.

Hope this helps.

Alan


On Thursday, February 13, 2014 5:27:58 PM UTC-8, t x wrote:
>
> Hi, 
>
> Preemptive: :-) 
>
>   * I'm not looking for datomic. 
>   * I'm also not looking for sqlkorma. 
>
>   * An "in-memory" data-log might be what I'm after. 
>
> Context: 
>
>   I'm reading: 
>     http://code.kx.com/wiki/JB:QforMortals2/tables 
>
>   and it struck me -- why can't I view a clojure {vector,list} of maps 
> as a table? I.e.: 
>
>   [{:tag :animal :type :dog :age 2} 
>   {:tag :animal :type :cat :age 4}] 
>
>   then do queries on things like: 
>
>     "get me all vector-indices of cats' of age >= 3" 
>
> Question: 
>
>   Is there a library (or even a blog post) about doing sql-like 
> querying on _in memory clojure data structures_ ? 
>
> Thanks! 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to