Created
October 10, 2012 17:09
-
-
Save devn/3866976 to your computer and use it in GitHub Desktop.
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
$ cd path_to_datomic | |
$ ./bin/rest 8080 free datomic:free://localhost:4334/ | |
$ cd path_to_datomic | |
$ bin/transactor config/samples/free-transactor-template.properties | |
$ git clone codeq | |
$ cd codeq | |
$ lein uberjar | |
$ java -server -Xmx1g -jar ~/dev/codeq/target/codeq-0.1.0-SNAPSHOT-standalone.jar datomic:free://localhost:4334/codeq | |
$ cd codeq | |
$ lein repl | |
(require '[datomic.api :as d]) | |
(def uri "datomic:free://localhost:4334/codeq") | |
(def db (d/connect uri)) | |
(def rules | |
'[[(node-files ?n ?f) [?n :node/object ?f] [?f :git/type :blob]] | |
[(node-files ?n ?f) [?n :node/object ?t] [?t :git/type :tree] | |
[?t :tree/nodes ?n2] (node-files ?n2 ?f)] | |
[(object-nodes ?o ?n) [?n :node/object ?o]] | |
[(object-nodes ?o ?n) [?n2 :node/object ?o] [?t :tree/nodes ?n2] (object-nodes ?t ?n)] | |
[(commit-files ?c ?f) [?c :commit/tree ?root] (node-files ?root ?f)] | |
[(commit-codeqs ?c ?cq) (commit-files ?c ?f) [?cq :codeq/file ?f]] | |
[(file-commits ?f ?c) (object-nodes ?f ?n) [?c :commit/tree ?n]] | |
[(codeq-commits ?cq ?c) [?cq :codeq/file ?f] (file-commits ?f ?c)]]) | |
(d/q '[:find ?src (min ?date) | |
:in $ % ?name | |
:where | |
[?n :code/name ?name] | |
[?cq :clj/def ?n] | |
[?cq :codeq/code ?cs] | |
[?cs :code/text ?src] | |
[?cq :codeq/file ?f] | |
(file-commits ?f ?c) | |
(?c :commit/authoredAt ?date)] | |
db rules "datomic.codeq.core/commit") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment