What I was imagining was using Prolog in place of RDBMS. That is a prolog engine to which you could connect using an analogue to ODBC, store facts there and query them. But this means you need a way to delete the facts as well - I don't know how this can be added to the Prolog computational model. I just started with Prolog and I don't really understand your sentence about backtracking over query results - but I think that backtracking in this environment would have to be limited by a transaction boundary.