Explaining queries in text is useful in many cases in order to allow for a conversation-style interaction between the user and the system. For example, when the user is asking a query in natural language, the system may end up with more than one possible SQL query that could be mapped to the user query due to ambiguity of natural language as well as the data itself. In that case, the system can translate these queries to natural language so that the user can inspect them and choose the correct one. In a different scenario,it may be the case that some part of the query is ambiguous. In that case, the system may again choose to translate the possible SQL interpretations of this part so that the user can help in the disambiguation.
Athena Research Center aims to add the capability for natural language explanations through Logos. Logos is a system that generates natural language translations for relational queries expressed in SQL. To do so, it considers that the database schema graph can be represented as a graph where nodes represent the database relations and attributes, and edges represent the relationships between the nodes (e.g., attribute belongs to relation, foreign key-primary key relationships connecting relations). Edges and nodes are annotated with labels that explain nodes and their relationships intuitively in natural language. These can include the names of the nodes (if they are descriptive enough) and annotations of the nodes and edges produced by a database designer or the user. An SQL query is also represented as a graph, that captures the semantics of the query, and extends the database schema graph to include value and function nodes. Given an SQL query, Logos can synthesize NL explanations using the graph, the labels, additional templates that enrich the explainability mechanism of the system and a template mechanism that dictates how to synthesize NL phrases.
Reference:
Andreas Kokkalis, Panagiotis Vagenas, Alexandros Zervakis, Alkis Simitsis, Georgia Koutrika, and Yannis Ioannidis. 2012. Logos: a system for translating queries into narratives. In Proceedings of the 2012 ACM SIGMOD International Conference on Management of Data (SIGMOD ’12).