I’m reading the Learn Datalog Today tutorial, kindly linked by @Siferiax and I have a few questions.
It’s a little odd that the author doesn’t show their Datomic database contents, as it could make the explanations more understandable, so I have to figure out what the database structure is myself to see the full picture.
I cannot request it directly tho:
[:find ?e ?a ?v ?tx
:where
[?e ?a ?v ?tx]
]
— as I get an error like:
Oh snap!
:db.error/insufficient-binding Insufficient binding of db clause: [?e ?a ?v ?tx] would cause full scan
However I can do this:
[:find ?e ?a
:where
[?e :db/ident ?a]
]
which (presumably) lists all the tuples containing the :db/ident
attribute. Great, and now I want to see just one - the :person/name
:
[:find ?e
:where
[?e :db/ident :person/name]
]
which gives me 68
:
Now I want to select all the attributes that have :person/name
as their value:
[:find ?e ?a
:where
[?e ?a :person/name]
]
but this one returns empty result. Why is that?