Add Datomic's Seattle neighborhood test data.
This commit is contained in:
parent
20d1b45293
commit
23ebc3a5fc
3 changed files with 2125 additions and 0 deletions
2021
fixtures/all_seattle.edn
Normal file
2021
fixtures/all_seattle.edn
Normal file
File diff suppressed because it is too large
Load diff
84
fixtures/cities.schema
Normal file
84
fixtures/cities.schema
Normal file
|
@ -0,0 +1,84 @@
|
|||
[
|
||||
{:db/ident :community/name
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/index true
|
||||
:db/fulltext true
|
||||
:db/doc "A community's name"}
|
||||
|
||||
{:db/ident :community/url
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A community's url"}
|
||||
|
||||
{:db/ident :community/neighborhood
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A community's neighborhood"}
|
||||
|
||||
{:db/ident :community/category
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/many
|
||||
:db/index true
|
||||
:db/fulltext true
|
||||
:db/doc "All community categories"}
|
||||
|
||||
{:db/ident :community/orgtype
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A community orgtype enum value"}
|
||||
|
||||
{:db/ident :community/type
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many
|
||||
:db/doc "Community type enum values"}
|
||||
|
||||
{:db/ident :community.orgtype/community}
|
||||
{:db/ident :community.orgtype/commercial}
|
||||
{:db/ident :community.orgtype/nonprofit}
|
||||
{:db/ident :community.orgtype/personal}
|
||||
|
||||
{:db/ident :community.type/email-list}
|
||||
{:db/ident :community.type/twitter}
|
||||
{:db/ident :community.type/facebook-page}
|
||||
{:db/ident :community.type/blog}
|
||||
{:db/ident :community.type/website}
|
||||
{:db/ident :community.type/wiki}
|
||||
{:db/ident :community.type/myspace}
|
||||
{:db/ident :community.type/ning}
|
||||
|
||||
;; district/region enum values
|
||||
{:db/ident :region/n}
|
||||
{:db/ident :region/ne}
|
||||
{:db/ident :region/e}
|
||||
{:db/ident :region/se}
|
||||
{:db/ident :region/s}
|
||||
{:db/ident :region/sw}
|
||||
{:db/ident :region/w}
|
||||
{:db/ident :region/nw}
|
||||
|
||||
{:db/ident :neighborhood/name
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/index true
|
||||
:db/unique :db.unique/identity
|
||||
:db/doc "A unique neighborhood name (upsertable)"}
|
||||
|
||||
{:db/ident :neighborhood/district
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A neighborhood's district"}
|
||||
|
||||
;; district
|
||||
{:db/ident :district/name
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/index true
|
||||
:db/unique :db.unique/identity
|
||||
:db/doc "A unique district name (upsertable)"}
|
||||
|
||||
{:db/ident :district/region
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A district region enum value"}
|
||||
]
|
20
fixtures/seattle.script
Normal file
20
fixtures/seattle.script
Normal file
|
@ -0,0 +1,20 @@
|
|||
.i fixtures/cities.schema
|
||||
.i fixtures/all_seattle.edn
|
||||
|
||||
.q [:find ?name ?cat
|
||||
:where
|
||||
[?c :community/name ?name]
|
||||
[?c :community/type :community.type/website]
|
||||
[(fulltext $ :community/category "food") [[?c ?cat]]]]
|
||||
|
||||
.q [:find ?c_name ?r_name
|
||||
:where
|
||||
[?c :community/name ?c_name]
|
||||
[?c :community/neighborhood ?n]
|
||||
[?n :neighborhood/district ?d]
|
||||
[?d :district/region ?r]
|
||||
[?r :db/ident ?r_name]]
|
||||
|
||||
.q [:find ?n . :where [(fulltext $ :community/name "Wallingford") [[?e ?n]]]]
|
||||
|
||||
.q [:find [?when ...] :where [_ :db/txInstant ?when] :order (asc ?when)]
|
Loading…
Reference in a new issue