This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy files preserving path; ae|web => source dirs; patch => target dir | |
for f in `git log --name-only -1 | awk /ae\|web/`; do find . -regex "./$f" -type f -exec cp --parents "{}" patch \;; done | |
# for-loop | |
for i in `seq 1 10`; do echo $i; done | |
# for-each + counter | |
c=10; for i in `seq 1 10`; do echo "$i => $c"; c=$[c+1]; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download | |
wget http://downloads.datomic.com/0.8.3848/datomic-pro-0.8.3848.zip | |
unzip datomic-pro-X.X.zip & cd datomic-pro-X.X | |
# install as a maven artifact | |
./bin/maven-install | |
# configure transactor.properties | |
cp config/samples/sql-transactor-template.properties transactor.properties | |
# protocol=sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; See http://stackoverflow.com/questions/15595540/datomic-insert-blocks | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] | |
:db/ident :car/model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.UUID; | |
import datomic.Connection; | |
import datomic.Peer; | |
import datomic.Util; | |
public class JavaDbFunction { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/16727590/what-is-a-good-way-of-finding-duplicates-in-datomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://duplicate-values") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; sample attribute definiton | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/16386793/datomic-query-function-that-filters-and-binds | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; sample attribute definiton | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/14724991/modelling-multiple-many-to-many-relationships-in-datomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [ ;; User | |
{:db/id #db/id [:db.part/db] | |
:db/ident :user/username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [{:db/id #db/id [:db.part/db] | |
:db/ident :enum/ns | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db/doc "Enum's namespace. Help enforce fk constraints on :db.type/ref enum references" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [;; Article | |
{:db/id #db/id [:db.part/db] | |
:db/ident :article/title | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/17190334/getting-the-id-of-an-inserted-entity-in-diatomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; create an atribute | |
(d/transact conn [{:db/id #db/id[:db.part/db] | |
:db/ident :some/attribute | |
:db/valueType :db.type/string |
OlderNewer