This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-28
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (19)
- # boot (7)
- # cider (9)
- # cljs-dev (311)
- # cljsjs (34)
- # cljsrn (8)
- # clojars (7)
- # clojure (41)
- # clojure-argentina (3)
- # clojure-russia (15)
- # clojure-spec (15)
- # clojure-uk (11)
- # clojurescript (83)
- # datomic (45)
- # emacs (7)
- # hoplon (13)
- # klipse (2)
- # lein-figwheel (1)
- # luminus (3)
- # om-next (1)
- # parinfer (5)
- # perun (1)
- # planck (1)
- # reagent (5)
- # spacemacs (2)
- # untangled (1)
- # yada (1)
Has anyone worked on a Datomic system that links to something like PostGIS? I’m thinking about keeping all the important info in Datomic and linking to the location data, but I’m wondering if anyone else has given any thought to how to keep that link as immutable as possible or any other real life gotchas that I haven’t considered yet.
If anyone can set me right re this that would be great: https://stackoverflow.com/questions/41910405/unable-to-resolve-entity-error-when-trying-to-transact-a-dataomic-taxonomy
Where above it says taxonomy read “schema"
If I have an attribute :event/order
declared as :db.unique/value
is there any way of asking datomic for a set of all attribute values?
Not :db.unique/value
since that wouldn't work... The question is more if I can get the set of values in a fast way
@alqvist Datalog? [:find ?order :where [_ :event/order ?order]]
or transducer + datoms index? (into #{} (comp (map :v) (distinct)) (seq (d/datoms db :avet :event/order)))
doubt you’d find a faster way than one of those two
if you have a LOT of usages, you could maintain a set separately as you discover new ones. so, move the work to transactor functions or the like.
my code assumes you’re :db/index true or :db/unique
@ezmiller77 well what is the transaction?
@pesterhazy you mean what was the actual transact call? It looked like this:
(def arb-tx (-> (io/resource "schemas/arb.edn")
(read-all)
(first)))
(pprint (<!! (client/transact conn {:tx-data arb-tx})))
where “schemas/arb.edn” is the schema listed in that stackoverflow question. I guess I should have included that in the Q.Try calling the transactions manually from the repl
why do you call first
there?
tx-data is supposed to be a collection of txs
just because (read-all) spits out a vector
so arb-tx
looked like: [[ <taxonomy definition maps> ]]
instead of [ <taxonomy definition maps> ]
read-all looks like:
(defn read-all
"Read all forms in f, where f is any resource that can
be opened by io/reader"
[f]
(Util/readAll (io/reader f)))
(copied from day-of-datomic)
do you see the same error when you run the code from the repl?
although removing first
, I get this error, also totally inscrutable to me:
{:datomic.client-spi/request-id "9c59aa1c-6127-45fd-87b2-afce72223ce1",
:cognitect.anomalies/category :cognitect.anomalies/incorrect,
:cognitect.anomalies/message
":db.error/not-a-data-function Unable to resolve data function: {:db/id {:idx -1000000, :part :db.part/db}, :db/ident :arb/title, :db/unique :db.unique/identity, :db/valueType :db.type/string, :db/cardinality :db.cardinality/one, :db/fulltext true, :db/index true, :db.install/_attribute :db.part/db}",
:dbs
[{:database-id "datomic:",
:t 1004,
:next-t 1009,
:history false}]}
i haven’t been able to figure out how to run it from the repl yet b/c I haven’t figured out how to do the edn file import from there
why don't you try transacting a simple map first?
then add stuff one by one
not sure what you mean by a simple map?
@(d/transact (rdc) [{:db/id (d/tempid :db.part/user) :db/doc "hello"}])
I guess from the client api it looks a bit different
oh well that i’ve done before
but i can try it again if you think it’s helpful.
well if you start with that and then add things bit by bit, I think you may be able to narrow in on the problem
the command you have there is using the datomic api right?
as opposed to the client?
damn, can’t even manage to enter that edn structure into the repl
gonna have to pick this up later.
thanks for trying to help @pesterhazy
the first line there in the schema defn :db/id #db/id [:db.part/db]
, is being interpreted as a function, which now that i look at it makes sense, so I get this error:
user=> (def arb-title [{:db/id #db/id [:db/part/db]}])
IllegalStateException Attempting to call unbound fn: #'datomic.db/id-literal clojure.lang.Var$Unbound.throwArity (Var.java:43)
RuntimeException Unmatched delimiter: } clojure.lang.Util.runtimeException (Util.java:221)
RuntimeException Unmatched delimiter: ] clojure.lang.Util.runtimeException (Util.java:221)
RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)
@robert-stuttaford Datalog. Probably going with maintaining a separate set since there might be millions of events.
@ezmiller77 that ain't right: :db/part/db