Pergunta

I am considering using datalog as a database backend for an application I am writing, because I see potential to allow me to switch between representations easily without having to sacrifice my collected data or write a cumbersome migration.

However, I can't foresee how I would deal with changing data -- e.g. something as simple as a user-changeable password. I had an idea to tag rows with a date:

changepassword(<user>, <passhash>, <date>)

and then use the latest, but there does not seem to be a way to get the latest, without returning all rows and filtering them on the application side.

How are datalog applications designed to handle changing data?

Foi útil?

Solução

If you look at http://c2.com/cgi/wiki?QueryLanguageComparison you'll see that Datalog doesn't have the capability to perform aggregation, min, max, top N and such, due to the transitive relationships and recursive queries.

Essentially you'd have to do any aggregation etc in the application layer, which is far from ideal.

However, there is at least one product (which I must admit I haven't used or looked into detail) which extends the Datalog syntax for these cases: Datomic, look up the section "Aggregates Returning a Single Value".

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top