Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the current Datomic schema? [duplicate]

Tags:

schema

datomic

Since the Datomic schema is itself stored in Datomic, how can I query Datomic to get the currently installed schema? I want to only get the user-level schema, excluding the system-level schema that has things like partitions.

like image 453
Jeff Terrell Ph.D. Avatar asked Oct 26 '14 16:10

Jeff Terrell Ph.D.


1 Answers

I only started learning Datomic and Datalog pretty recently, so I don't know if things have just changed in the three years it's been since the previous answer, or if this is just a different way of doing the same thing:

[:find ?attr ?type ?card
 :where
 [_ :db.install/attribute ?a]
 [?a :db/valueType ?t]
 [?a :db/cardinality ?c]
 [?a :db/ident ?attr]
 [?t :db/ident ?type]
 [?c :db/ident ?card]]

It will give you something that looks like this:

schema query results

Taken from http://www.learndatalogtoday.org/chapter/4 (solution to challenge 2 at the bottom).

like image 70
weltschmerz Avatar answered Sep 19 '22 12:09

weltschmerz