Foundations of Deductive Databases and Logic Programming