Intelligent Query Answering with Contextual Knowledge for Relational Databases

Authors Dietmar Seipel, Daniel Weidner, Salvador Abreu

Thumbnail PDF


  • Filesize: 0.74 MB
  • 15 pages

Document Identifiers

Author Details

Dietmar Seipel
  • Department of Computer Science, Universität Würzburg, Germany
Daniel Weidner
  • Department of Computer Science, Universität Würzburg, Germany
Salvador Abreu
  • Nova-Lincs, University of Évora, Portugal

Cite AsGet BibTex

Dietmar Seipel, Daniel Weidner, and Salvador Abreu. Intelligent Query Answering with Contextual Knowledge for Relational Databases. In 10th Symposium on Languages, Applications and Technologies (SLATE 2021). Open Access Series in Informatics (OASIcs), Volume 94, pp. 16:1-16:15, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2021)


We are proposing a keyword-based query interface for knowledge bases - including relational or deductive databases - based on contextual background knowledge such as suitable join conditions or synonyms. Join conditions could be extracted from existing referential integrity (foreign key) constaints of the database schema. They could also be learned from other, previous database queries, if the database schema does not contain foreign key constraints. Given a textual representation - a word list - of a query to a relational database, one may parse the list into a structured term. The intelligent and cooperative part of our approach is to hypothesize the semantics of the word list and to find suitable links between the concepts mentioned in the query using contextual knowledge, more precisely join conditions between the database tables. We use a knowledge-based parser based on an extension of Definite Clause Grammars (Dcg) that are interweaved with calls to the database schema to suitably annotate the tokens as table names, table attributes, attribute values or relationships linking tables. Our tool DdQl yields the possible queries in a special domain specific rule language that extends Datalog, from which the user can choose one.

Subject Classification

ACM Subject Classification
  • Information systems → Data management systems
  • Knowledge Bases
  • Natural Language Interface
  • Logic Programming
  • Definite Clause Grammars
  • Referential Integrity Constraints


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Katrin Affolter, Kurt Stockinger, and Abraham Bernstein. A Comparative Survey of Recent Nlis for Databases. VLDB J., 28(5):793-819, 2019. URL:
  2. Lukas Blunschi, Claudio Jossen, Donald Kossmann, Magdalini Mori, and Kurt Stockinger. Soda: Generating Sql for Business Users. Proc. VLDB Endowment, 5(10):932-943, 2012. URL:
  3. Ivan Bratko. Prolog Programming for Artificial Intelligence. Addison-Wesley Longman, 4th edition, 2011. Google Scholar
  4. Gerhard Brewka, Thomas Eiter, and Mirek Truszczynski. Answer Set Programming at a Glance. Communications of the ACM, 54(12):92-103, 2011. Google Scholar
  5. Andreas Böhm, Dietmar Seipel, Albert Sickmann, and Matthias Wetzka. Squash: A Tool for Designing, Analyzing and Refactoring Relational Database Applications. In Proc. International Conference on Applications of Declarative Programming and Knowledge Management (INAP), pages 82-98, 2007. Google Scholar
  6. Ceri, Stefano and Gottlob, Georg and Tanca, Laetitia. Logic Programming and Databases. Springer, 1990. Google Scholar
  7. William Clocksin and Christopher S. Mellish. Programming in Prolog. Springer Science & Business Media, 2003. Google Scholar
  8. Danica Damljanovic, Milan Agatonovic, and Hamish Cunningham. Nlis to Ontologies: Combining Syntactic Analysis and Ontology-based Lookup through the User Interaction. In Extended Semantic Web Conf., pages 106-120. Springer, 2010. Google Scholar
  9. Ramez Elmasri and Shamkant B. Navathe. Fundamentals of Database Systems, 3rd Edition. Addison-Wesley Longman, 2000. Google Scholar
  10. Hector Garcia-Molina, Jeffrey Ullman, and Jennifer Widom. Database Systems: The Complete Book, volume 638. Pearson Prentice Hall, 2009. Google Scholar
  11. Ben Goertzel. Perception Processing for General Intelligence: Bridging the Symbolic/Subsymbolic Gap. In International Conference on Artificial General Intelligence, pages 79-88. Springer, 2012. Google Scholar
  12. Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deep Speech: Scaling up End-to-End Speech Recognition. arXiv preprint, 2014. URL:
  13. Nicola Leone, Gerald Pfeifer, Wolfgang Faber, Thomas Eiter, Georg Gottlob, Simona Perri, and Francesco Scarcello. The dlv System for Knowledge Representation and Reasoning. ACM Transactions on Computational Logic, 7(3):499-562, 2006. Google Scholar
  14. Fei Li and H. V. Jagadish. Understanding Natural Language Queries over Relational Databases. SIGMOD Rec., 45(1):6-13, 2016. URL:
  15. Clayton McMillan, Michael C Mozer, and Paul Smolensky. Rule Induction through Integrated Symbolic and Subsymbolic Processing. In Advances in Neural Information Processing Systems, volume 4, pages 969-976, 1992. Google Scholar
  16. Jack Minker, Dietmar Seipel, and Carlo Zaniolo. Logic and Databases: A History of Deductive Databases. In Jörg H. Siekmann, editor, Computational Logic, volume 9 of Handbook of the History of Logic, pages 571-627. Elsevier, 2014. URL:
  17. Falco Nogatz, Julia Kübert, Dietmar Seipel, and Salvador Abreu. Alexa, How Can I Reason with Prolog? (Short Paper). In Proc. 8th Symposium on Languages, Applications and Technologies (SLATE 2019), 2019. Google Scholar
  18. Christian Schneiker, Dietmar Seipel, Werner Wegstein, and Klaus Prätor. Declarative Parsing and Annotation of Electronic Dictionaries. In Proc. 6th International Workshop on Natural Language Processing and Cognitive Science (NLPCS 2009), 2009. Google Scholar
  19. Dietmar Seipel. Declare - A Declarative Toolkit for Knowledge-Based Systems and Logic Programming. URL:
  20. Dietmar Seipel. Processing Xml-Documents in Prolog. In Workshop on Logic Programming (WLP 2002), 2002. Google Scholar
  21. Dietmar Seipel, Rüdiger von der Weth, Salvador Abreu, Falco Nogatz, and Alexander Werner. Declarative Rules for Annotated Expert Knowledge in Change Management. In Proc. 5th Symposium on Languages, Applications and Technologies (SLATE 2016), 2016. Google Scholar
  22. Steffen Staab and Rudi Studer, editors. Handbook on Ontologies, International Handbooks on Information Systems. Springer, 2009. URL:
  23. Kurt Stockinger. The Rise of Natural Language Interfaces to Databases. ACM SIGMOD Blog, URL:, 2019.