Created
April 6, 2012 18:15
-
-
Save stuarthalloway/2321773 to your computer and use it in GitHub Desktop.
Datomic schema query, constrained by attribute namespace
This file contains hidden or 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 sample code | |
;; schema query for attribute types in specified namespaces | |
(q '[:find ?attr | |
:in $ [?include-ns ...] ;; bind ?include-ns once for each item in collection | |
:where | |
[?e :db/valueType] ;; all schema types (must have a valueType) | |
[?e :db/ident ?attr] ;; schema type name | |
[(datomic.Util/namespace ?attr) ?ns] ;; namespace of name | |
[(= ?ns ?include-ns)]] ;; must match one of the ?include-ns | |
(db conn) | |
["db.install" "fressian"]) ;; collection for ?include-ns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This hangs when run against Datomic Cloud with Client API v0.8.53 because database functions are not supported on Cloud (only on-prem), but I expect to see an anomaly returned by the API. In CloudWatch you'll see a ClientSPIFault, java.lang.ClassNotFoundException: datomic.Util.namespace.