Institute for Informatics
Georg-August-Universität Göttingen

Databases and Information Systems

Uni Göttingen

Deductive Databases
WS 2016/17

Prof. Dr. Wolfgang May

Date and Time: Wednesday 10-12, IFI SR 2.101 and changed: Friday 14-16 ct, IFI SR 1.101.

Lecture and Exercises mixed (see announcements on this page).
If (and as long as) non-german-speaking participants attend, the course will be given in english.

Module CS.M.inf.1241:
The module's home is the MSc studies in Applied CS. It can also be credited in the BSc studies in Applied CS, and in several other studies:
6 ECTS credits (Studies in Applied Informatics and in MSc Wirtschaftsinformatik),
Maths (Dipl, MSc), Teaching, Magister, PhD GAUSS, ...

Note: participants are required to have successfully attended the module Databases or an equivalent module.

Note: the course is a prerequisite for "Semantic Web" (prospectively in SS2017) since it provides the necessary basic knowledge in logics.

Enrolment: there is no official enrollment for DBT. Students may freely decide to attend the lecture. Only at the end, for the exams, there is a registration (with FlexNever).
In general, I don't use StudIP (it is a lot of additional work, and past misfunctions of it resulted in severe problems). You find all relevant information about the lecture at this Website.

Course Description

The course combines theoretical aspects with their applications in deductive databases and knowledge representation:

  • First-Order Logic
  • The first-oder-logic-based twin to the relational algebra: Relational Calculus; domain-independence, safeness; translation of queries between Algebra and Calculus
  • Model Theory, Reasoning and Query Answering in First-Order Logic: Resolution and Tableau Calculus
  • Conjunctive queries (Datalog queries)
  • Deductive Databases - Positive Recursive Datalog
  • Advanced Datalog: Datalog with Negation, Well-Founded Semantics, Stable Semantics, Answer Set Programming (ASP).
  • Practical Exercises will be done with XSB Prolog/Datalog and smodels.
  • The running example is the "Mondial" database. SQL queries against Mondial can be stated via a Web interface.
  • On a higher level, students will gain some insights into (commonsense) reasoning and about the intuitive background of formal logical frameworks.
  • Example for reasoning: Fish Puzzle:
    First step: find a solution (by human reasoning). This will finally be solved by ASP.

Dates & Topics


  • Oral exams, between 6.2.2017 and April 2017 with individual appointments:
    • Exam period in February: 6.2.-24.2.
    • Exam period in March: 6.3.-10./17.3.
    • Exam period in April: 3./10.4.-21.4. (Summer term lectures start on 10.4., 14.4.-17.4.: Easter)
    • Exam period in April: 24.4.-5.5.
    • Please contact may at for the individual appointments/slots.
    • The exams take place in my office, Room 2.107, Inst.f.Informatik.
  • Exam procedure: about 30-40 minutes. Candidates start with talking about a topic of their choice (5-10 minutes), then questions+answers, including sketches on paper develops dynamically.
    Languages: German, English.


  • All slides of DBIS lectures can be found here.
  • Some topics of the course are closely related to chapters of the book Foundations of Databases by Serge Abiteboul, Richard Hull, and Victor Vianu that can be found as pdf here.
  • A comprehensive course in logics (incl. slides and a skriptum) (in German) can be found at Formale Systeme, Prof. Dr. P.H.Schmitt, Karlsruhe (im wesentlichen Kapitel 4 und 5).


  • SQL-Queries on the Mondial database can be stated via this web form.
  • Mondial in Datalog is available here.
  • The Datalog sample programs from the slides are available here.
  • For experimenting with Datalog, the XSB system is installed in the IFI CIP-Pool:
       alias xsb='rlwrap ~dbis/LP-Tools/XSB/bin/xsb'
    to your ~/.bashrc and then source .bashrc. Go to the directory where your input sources (e.g. mondial.P from above) is located and call
     may@pc01> xsb
    The xsb prompt is then ?- .
    To leave XSB, press CTRL-D.
     ?- [mondial].
    to "load" mondial into XSB (The file mondial.P must be in the current directory). Query with e.g.
     ?- country(A,B,C,D,E,F).
    returns the first answer. Press "return" once to leave answers, press any other key and "return" to get next answer.
    Some usage hints:
    • String constants are enclosed in single quotes (like in SQL): ?- city('Berlin',C,P,Pop,_,_,_).
      Double quotes are not allowed.
    • ?- city(N,C,P,Pop,_,_,_), Pop > 1000000 . ... complains about "Wrong domain in evaluable function compare-operator/2."
      There is no SQL-style NULL in Datalog. Instead we use the constant null; this breaks the domain for numerical comparison. So check first that P is not null (unequality can be written as "x \= y" or "not (x=y)" in Prolog):
      ?- city(N,C,P,Pop,_,_,_), Pop \= null, Pop > 1000000 .
      ?- city(N,C,P,Pop,_,_,_), not (Pop = null), Pop > 1000000 .
  • Download of XSB Prolog/Datalog from Stony Brook University.
  • For experimenting with stable models, smodels and its lparse frontend are installed in the CIP pool:
       alias smodels='~dbis/LP-Tools/smodels-2.34/smodels'
       alias lparse='~dbis/LP-Tools/lparsebin/lparse'
    to your ~/.bashrc and then source .bashrc. Then call
     may@pc01>  lparse -n 0 porq.s|smodels
     may@pc01>  lparse -n 0 -d none winmove.s|smodels
     may@pc01>  lparse -n 0 -d none --partial winmove.s|smodels
    where -n 0 indicates to show all stable models (any number can be given 0 means "all"). Option -d none omits the EDB predicates from the models. Option --partial also outputs the partial stable models, where an output of p'(...) then means that p(...) is a least undefined.
    See lparse -help and smodels -help for further options.
  • Download smodels and lparse from Helsinki University of Technology.
    • gunzip both, unpack with tar xvf.
    • cd into smodels-X.YZ, run make, creates smodels binary.
      Assign an alias for calling it.
    • cd into lparse-X.Y.Z, edit INSTALLATION_PATH in Makefile, read INSTALL text, and do what is recommended.
      Assign an alias for calling it.