In Datomic, a Datalog query is written in extensible data notation (edn). Edn is a data format similar to JSON, but it:
Edn consists of:
42
, 3.14159
"This is a string"
:kw
, :namespaced/keyword
, :foo.bar/baz
max
, +
, ?title
[1 2 3]
[:find ?foo ...]
(3.14 :foo [:bar :baz])
, (+ 1 2 3 4)
#inst "2013-02-26"
Here is an example query that finds all movie titles in our example database:
[:find ?title
:where
[_ :movie/title ?title]]
Note that the query is a vector with four elements:
:find
?title
:where
[_ :movie/title ?title]
We'll go over the specific parts of the query later, but for now you should simply type the above query verbatim into the textbox below, press Run Query, and then continue to the next part of the tutorial.