What helped me with SQL to datalog is to keep in mind that datalog where clauses are based on table form.
So
select *
from table
where column = value
Becomes
{:query [:find (pull ?id [*]) ;this is the select, get all attribute (columns) for this ?id
:where
[?id column value]
]
}
As datalog just has 1 table, there is no from.
The table has a number of columns, but you generally use 3.
The first is the id (of the entity, think of this as the table name), the second the attribute (column) name and the third the attribute (column) value.
The value can be the id of another entity in the table.
We can substitute the actual values in the database for either a variable (?name) or a _ to signal any value.
The second query you posted will find pages under namespace “project” but only the ones directly below. So project/page 1, but not project/page 1/page 2.
Also in "WAITING"}, ?t)] there’s a comma that doesn’t belong there.