Automatic creation of schema annotation files for converting natural language queries to structured query language
AssigneeInternational Business Machines Corporation
InventorsElahe Khorasani, Hangu Yeo, Octavian Popescu, Vadim Sheinin
Life of this patent
Estimating the term…
Abstract
Methods, systems and computer readable media are provided for automatically creating a semantic model of a relational database for processing natural language queries. A computing device automatically extracts relational database metadata. The computing device prompts a user to enter textual labels for columns of the extracted metadata. The computing device automatically generates a schema annotation file based upon the relational database metadata and the textual labels for the columns. A natural language query is processed for the relational database using the schema annotation file.
Claims14
An automated method using a computing device to create a semantic model of a relational database for processing natural language queries, the method comprising:
- extracting automatically, by the computing device, relational database metadata, wherein the extracted metadata includes information for database table columns of the relational database;
- prompting, by the computing device, textual labels from a user for annotating the database table columns of the extracted metadata, wherein the textual labels include a semantic type and description for a corresponding database table column;
- annotating, by the computing device, the database table columns of the extracted metadata with the textual labels provided by the user;
- automatically generating, by the computing device, a schema annotation file based upon the extracted metadata and the textual labels provided by the user for annotating the database table columns of the extracted metadata, wherein the schema annotation file includes entries that describe entities and entity relationships in the relational database and associate the entities to database objects, and automatically generating the schema annotation file comprises:
- classifying words of the description of the textual labels into a set of categories based on semantic type and part of speech, wherein classification results for sets of the words correspond to patterns for semantic relationships;
- determining verbs for use between the words of the description of the textual labels classified as nouns;
- and
- generating at least one entry for the schema annotation file including the words of the description of at least one textual label and the determined verbs based on the semantic relationships;
- processing, by the computing device, the schema annotation file into lexical rules with semantic annotation corresponding to the relational database, wherein the lexical rules indicate a syntax for natural language and include terms from the schema annotation file including the words of the description of one or more textual labels;
- and
- processing a natural language query for the relational database including the words of the description of a textual label, wherein processing the natural language query comprises:
- applying the lexical rules to the natural language query to detect terms of the natural language query associated with the relational database and semantic relationships between the terms;
- creating a set of structured phrases from the detected terms and semantic relationships within the natural language query;
- and
- converting the structured phrases to structured query language clauses to produce a structured query.
A system for creating a semantic model of a relational database for processing natural language queries, the system comprising:
- one or more processors;
- one or more computer readable storage media;
- program instructions stored on the one or more computer readable storage media for execution by the one or more processors, the program instructions comprising instructions to:
- extract automatically relational database metadata, wherein the extracted metadata includes information for database table columns of the relational database;
- prompt textual labels from a user for annotating the database table columns of the extracted metadata, wherein the textual labels include a semantic type and description for a corresponding database table column;
- annotate the database table columns of the extracted metadata with the textual labels provided by the user;
- automatically generate a schema annotation file based upon the extracted metadata and the textual labels provided by the user for annotating the database table columns of the extracted metadata, wherein the schema annotation file includes entries that describe entities and entity relationships in the relational database and associate the entities to database objects, and automatically generating the schema annotation file comprises:
- classifying words of the description of the textual labels into a set of categories based on semantic type and part of speech, wherein classification results for sets of the words correspond to patterns for semantic relationships;
- determining verbs for use between the words of the description of the textual labels classified as nouns;
- and
- generating at least one entry for the schema annotation file including the words of the description of at least one textual label and the determined verbs based on the semantic relationships;
- process the schema annotation file into lexical rules with semantic annotation corresponding to the relational database, wherein the lexical rules indicate a syntax for natural language and include terms from the schema annotation file including the words of the description of one or more textual labels;
- and
- process a natural language query for the relational database including the words of the description of a textual label, wherein processing the natural language query comprises:
- applying the lexical rules to the natural language query to detect terms of the natural language query associated with the relational database and semantic relationships between the terms;
- creating a set of structured phrases from the detected terms and semantic relationships within the natural language query;
- and
- converting the structured phrases to structured query language clauses to produce a structured query.
A computer program product for creating a semantic model of a relational database for processing natural language queries, the computer program product comprising one or more computer readable storage media collectively having program instructions stored on the one or more computer readable storage media, the program instructions executable by a computer to cause the computer to:
- extract automatically relational database metadata, wherein the extracted metadata includes information for database table columns of the relational database;
- prompt textual labels from a user for annotating the database table columns of the extracted metadata, wherein the textual labels include a semantic type and description for a corresponding database table column;
- annotate the database table columns of the extracted metadata with the textual labels provided by the user;
- automatically generate a schema annotation file based upon the extracted metadata and the textual labels provided by the user for annotating the database table columns of the extracted metadata, wherein the schema annotation file includes entries that describe entities and entity relationships in the relational database and associate the entities to database objects, and automatically generating the schema annotation file comprises:
- classifying words of the description of the textual labels into a set of categories based on semantic type and part of speech, wherein classification results for sets of the words correspond to patterns for semantic relationships;
- determining verbs for use between the words of the description of the textual labels classified as nouns;
- and
- generating at least one entry for the schema annotation file including the words of the description of at least one textual label and the determined verbs based on the semantic relationships;
- process the schema annotation file into lexical rules with semantic annotation corresponding to the relational database, wherein the lexical rules indicate a syntax for natural language and include terms from the schema annotation file including the words of the description of one or more textual labels;
- and
- process a natural language query for the relational database including the words of the description of a textual label, wherein processing the natural language query comprises:
- applying the lexical rules to the natural language query to detect terms of the natural language query associated with the relational database and semantic relationships between the terms;
- creating a set of structured phrases from the detected terms and semantic relationships within the natural language query;
- and
- converting the structured phrases to structured query language clauses to produce a structured query.
Dependencies are inferred from the claim text.