Logos

A template-based approach for generating natural laguage explanations of SQL queries

Description

Logos is a system which offers textual explanations of SQL queries using a directed graph model, called database graph, describing the underlying database. The database graph captures the relationships between the database tables and attributes (nodes of the graph). Each time a query is given to the system, Logos detects the part of the database graph to which the query refers to and (if necessary) it enriches it with more nodes and edges in order to capture its entire meaning. The produced graph is called query graph. Each node or edge of the query graph can be annotated with a label that signifies its meaning in natural language. There are default labels that can be used for any database. Additionally, labels can be provided by a domain expert. Synthesis of the NL explanations is performed as graph traversal of the query graph.


Example

Let us consider the CORDIS database, which stores information about research projects funded by the European Union.

A subgraph of the CORDIS database graph.
In the above figure, we see a subgraph of the corresponding database graph. Note that for simplicity, we do not show the attributes used to join the various relations. By default, the name of each node is also its label. We also see how edges are annotated with default labels.

Let us assume that we want the explanation of the following SQL query: "SELECT total_cost, ec_max_contribution, framework_program, ec_fund_scheme FROM projects WHERE framework_program IN (’FP7’) AND ec_fund_scheme NOT IN (’ERC-SG’, ’ERC-CG’);".

Logos takes the related to the SQL query subgraph of the database graph, adds the corresponding nodes and edges associated with the IN and NOT IN operators, and generates the query graph given in the figure below:
A query with IN and NOT IN operators.
By traversing the query graph, the natural language explanation "Find the total costs, max contributions, framework programs and fund schemes of projects whose framework program is FP7 and fund scheme is not ERC-SG and ERC-CG." is created.

Key Persons