Skip to content

Instantly share code, notes, and snippets.

@Jaretbinford
Created June 2, 2017 14:50
Show Gist options
  • Save Jaretbinford/37eafd2dfaae69523df3a576cf1f403b to your computer and use it in GitHub Desktop.
Save Jaretbinford/37eafd2dfaae69523df3a576cf1f403b to your computer and use it in GitHub Desktop.
Re-create for case
(ns entitytest
(:require [clojure.core.async :refer (<!!)]
[datomic.client :as client]
[datomic.api :as d]))
(def db-uri "datomic:dev://localhost:4334/entity")
(d/create-database db-uri)
(def conn (d/connect db-uri))
@(d/transact conn [{:db/ident :sample/sample_concentration,
:db/valueType :db.type/float,
:db/cardinality :db.cardinality/one,
:db/unique :db.unique/identity
:db/doc "float field",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 254]}])
@(d/transact conn [{:db/ident :sample/specimen,
:db/valueType :db.type/ref,
:db/cardinality :db.cardinality/one,
:db/unique :db.unique/identity
:db/doc "ref",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 256]}])
(def conflict
[:db/add 13194139534312 :sample/sample_concentration 861.01])
(def conflict2
[:db/add 13194139534313 :sample/specimen :sample/sample_concentration])
(def db (d/db conn))
@(d/transact conn [conflict])
@(d/transact conn [conflict2])
(d/q '[:find ?e
:where
[?e :sample/specimen "IB"]]
(d/db conn))
(d/q '[:find ?e
:where
[?e :sample/sample_concentration "IB"]]
(d/db conn))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment