Fork me on GitHub
#datomic
<
2016-07-27
>
hueyp01:07:46

when sorting a list of entities by an attribute … is there a way to read from the sorted index (well, is there a sorted index?) … or just query entity-id and attribute-value and sort in memory?

hueyp01:07:08

index being EAVT in this case (right?)

cezar01:07:06

well, AEVT and AVET are sorted by attribute... you could use one of those. The doc page on Datomic has a good description of how the different indices are laid out: http://docs.datomic.com/indexes.html

hueyp03:07:14

yah, I’m dumb, I meant AVET, not EAVT 😜

hueyp03:07:39

@cezar: thanks 🙂

hueyp04:07:20

perfect, have never used the datoms API, looks like what I want

ethangracer17:07:22

hi all, is anyone familiar with a way to incorporate a recursive search into a query? I know that there is the symbol for recursion in pull syntax, but I’m not seeing anything in the query grammar. Right now I’m resorting to writing recursive rules, which are kind of brutal:

'[[(item-for-subitem ?item ?sub)
   (or-join [?item ?sub]
     [?item :item/subitem ?sub]
     (and
       (item-for-subitem ?item ?mid)
       [?mid :item/subitem ?sub]))]]

val_waeselynck17:07:00

@ethangracer: recursive rules is the way to go I think, but you usually don't write them with an or-join, you just declare 2 implementations of the rule

ethangracer17:07:16

@val_waeselynck: so, something like this?

'[[(item-for-subitem ?item ?sub)
   [?item :item/subitem ?sub]]
 [(item-for-subitem ?item ?sub)
  (item-for-subitem ?item ?mid)
  [?mid :item/subitem ?sub]]]
That seems less clearly recursive to me for some reason, but if that’s the standard, good to know

nando18:07:45

hi all, I’m new to both Clojure and Datomic, but I’ve been hovering around both for awhile now. Downloaded Datomic Pro Starter, have the http://my.datomic.com credentials, trying to experiment with Datomic Pro using boot. For an IDE, I’m using Atom with the proto-repl plugin.

nando18:07:13

When I tried to start the repl from the build.boot file I have open, I got the following error:

No such task (dev)
          boot.core/construct-tasks  
core.clj

nando18:07:47

I figured I needed a deftask named dev, and sure enough, adding this to build.boot got around that error:

(deftask dev [])

dominicm18:07:18

@nando: You probably want (deftask dev [] (repl))

dominicm18:07:10

I think dev is the task proto repl expects to start your repl, but doesn't call repl directly to allow you to do things like start file watchers or compile sass

nando18:07:38

Ok, I changed it and that works.

nando19:07:38

Now, to start using Datomic pro, I’ve added a dependency to my build.boot file, like so:

(set-env! :resource-paths #{"src"}
				:dependencies   '[[org.clojure/clojure "RELEASE"]
                            [framework-one       "RELEASE"]
							[com.datomic/datomic-pro "0.9.5385"]]
				:repositories #(conj %
                      ["my-datomic" {:url ""
                                     :username “my-datomic-user"
                                     :password “my-datomic-pass"}]))

nando19:07:37

Using the require statement I see in the tutorial doesn’t seem to work if I try and evaluate it in the repl:

(ns telogenix.model.schema
  (:require [datomic.api :as d]))
user=> ClassNotFoundException clojure.lang.Tuple  java.net.URLClassLoader.findClass (URLClassLoader.java:381)

nando19:07:00

I’m stuck here.

nando19:07:54

The dependency and repository seem to be correct, because I can run the project and all dependencies seem to resolve without error.

Ben Kamphaus19:07:58

Smells like an IDE/config issue, not Datomic specific. I’d ask boot, atom users or in an editor/ide channel. also “RELEASE” if present in that form also needs a real version number added.

nando19:07:25

It works without datomic

dominicm19:07:37

@bkamphaus: I think RELEASE works without a number, no?

dominicm19:07:25

@nando: Could you try (require '[datomic.api :as d]) at the repl instead? Not entirely sure how the user repl behaves when subject to (ns)

nando19:07:04

That works!

nando19:07:44

At least it doesn’t throw an error.

dominicm19:07:24

You should be able to do (d/conn ...) and all the other good parts of the datomic api. connecting is a decent test.

Ben Kamphaus19:07:51

oh, ok, I haven’t used metaversions ever, nevermind on that.

nando19:07:24

Ok, I’m playing with it.

dominicm19:07:28

@bkamphaus: They're, admittedly, dodgy. But a fairly good way to get going fast.

nando19:07:37

Is following the example code in the seattle subdirectory still the recommended way to get started?

nando19:07:56

Or is there something more current? I’m referring to the sample app included with the datomic download.

nando19:07:03

@dominicm: thanks for getting me unstuck

dominicm19:07:27

@nando: No problem. Sorry I can't answer your other questions.

nando19:07:42

NP. I’ll continue to muddle through and try to get something working. I’ll start by creating a schema.edn file now that I seem to have datomic set up.

kschrader20:07:37

if I’m using the memcached support and the memcached server falls over do the peers just fall back to using storage directly for everything?

kschrader20:07:53

(assuming yes, but can’t find anything in the docs about how it handles failure conditions)