A computer program product, comprising a computer-readable hardware storage device having a computer-readable program code stored therein, the program code configured to be executed by a database management system (DBMS) comprising a processor, a memory coupled to the processor, and a computer-readable hardware storage device coupled to the processor, the storage device containing program code configured to be run by the processor via the memory to implement a method for a natural-language database interface with automated keyword mapping and join-path inferences, the method comprising:
- receiving, by the DBMS, a natural-language query (NLQ) submitted by a user of the DBMS, wherein the NLQ requests access to information organized into at least two elements of a database managed by the DBMS, wherein each element of the at least two elements is either a relation of the database or an attribute of the database;
- extracting, by the DBMS, a set of keywords from the NLQ;
- selecting, by the DBMS, a set of candidate mapping configurations, wherein each configuration of the set of candidate mapping configurations identifies a unique combination of keyword mappings that maps the entire set of extracted keywords onto a set of query fragments;
- retrieving, by the DBMS, a query fragment graph (QFG) that counts occurrences, in previously logged structured queries, of each query fragment identified by a keyword mapping of any configuration of the set of candidate mapping configurations;
- choosing, by the DBMS, an optimal configuration from the set of candidate mapping configurations,
- wherein the optimal configuration identifies an optimal set of query fragments, and
- wherein the optimal set of query fragments contains pairs of query fragments that are identified by the QFG as co-occurring in the previously logged structured queries more frequently than do pairs of query fragments identified by other configurations of the candidate mapping configurations;
- generating, by the DBMS, a structured query that comprises the optimal set of query fragments;
- and
- forwarding the structured query, by the DBMS, to a downstream component of the DBMS.