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
;; Datomic example code | |
;; demonstrates various update scenarios, using a news database | |
;; that contains stories, users, and upvotes | |
;; grab an in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://foo") | |
(d/create-database uri) | |
(def conn (d/connect uri)) |
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
;; The Datomic schema is made up of Datomic data, so you manipulate it | |
;; with ordinary queries and transactions -- and with ordinary code | |
;; in Java or Clojure. | |
;; query rule that finds attributes in schema whose names start with ?prefix | |
;; note the Java interop call to .startsWith | |
;; you could create a similar rule for namespace prefixes | |
(def rules '[[[attr-starts-with ?prefix ?attr] | |
[?e :db/valueType] | |
[?e :db/ident ?attr] |