Preference queries in deductive databases
Traditional database query languages such as datalog and SQL allow the user to specify only mandatory requirements on the data to be retrieved from a database. In many applications, it may he natural to express not only mandatory requirements but also preferences on the data to be retrieved. Lacroix and Lavency(10)) extended SQL with a notion of preference and showed how the resulting query language could still be translated into the domain relational calculus. We explore the use of I,reference in databases in the setting of datalog. We introduce the formalism of preference datalog programs (PDPs) as preference logic programs without uninterpreted function symbols for this purpose. PDPs extend datalog not only with, constructs to specify which predicate is to he optimized and the criterion for optimization but also with constructs to specify which predicate to be relaxed and the criterion to be used for relaxation. We can show that all of the soft requirements in Reference(10)) can be directly encoded in PDP. We first develop a naivety-pruned bottom-up evaluation procedure that is sound and complete for computing answers to normal and relaxation queries when the PDPs are stratified, we then show how the evaluation scheme can be extended to the case when the programs are not necessarily stratified, and finally we develop an extension of the magic templates mettled for datalog(14)) that constructs an equivalent but more efficient program for bottom-up evaluation.
database query language datalog bottom-up evaluation relaxation queries preferences and constraints