NLQ-to-SQL Conversion via Ontological Codes and Placeholders

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Converting natural language queries (NLQs) to structured query language queries (SQLQs) is challenging in domains like healthcare and life sciences due to complexities such as different medical ontologies and codes, making it difficult for users with limited technical knowledge to retrieve data from databases.

Innovation Solution

A system that uses machine learning-based models and ontological codes with placeholders to convert NLQs into SQLQs, leveraging predefined SQL subquery templates and custom entity recognition rules to disambiguate medical codes and generate executable SQL queries, allowing users to query databases using natural language.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If traditional NLQ-to-SQL conversion approaches are used, then users with limited technical knowledge can retrieve data, but conversion fails in domains with complex ontologies like healthcare and life sciences

Engineering Contradiction:
Improveease of data retrievalVSAvoiddomain adaptability
Core Design Contradiction:
Ease of operationVSAdaptability or versatility

Solution Approach 1:

The patent introduces an intermediary layer consisting of ontology codes and placeholders that mediates between natural language queries and SQL queries. The system maps NLQ terms to ontology codes (e.g., medical concepts to SNOMED CT codes), which then map to database tables and columns. This intermediary translation layer enables accurate data retrieval in complex domains like healthcare by resolving ontology-specific terminology without requiring users to understand the underlying complexity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If users with limited technical knowledge query databases directly, then data retrieval is simple, but technical barriers prevent access in complex domains

Engineering Contradiction:
Improveease of data retrievalVSAvoidtechnical complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The system performs self-service by automatically handling the complex translation and mapping processes without requiring user intervention. The NLQ-to-SQL conversion system autonomously maps natural language terms to ontology codes, resolves ambiguities, generates appropriate SQL queries, and executes them against the database. This eliminates the need for users to manually navigate complex ontology structures or write SQL queries, while the system manages all technical complexity behind the scenes.

Inventive Principle:
Principle #25Self-service

3Ease of manufacture

If static ontology mappings are used, then conversion is straightforward, but the system cannot adapt to dynamically changing ontologies

Engineering Contradiction:
Improveconversion simplicityVSAvoidontology adaptability
Core Design Contradiction:
Ease of manufactureVSAdaptability or versatility

Solution Approach 1:

The patent implements dynamics by enabling the ontology code to code mappings to be updated and evolved over time. The system maintains dynamic mappings between natural language terms, ontology codes, and database schemas, allowing these relationships to be modified when ontologies change. This dynamic adaptation capability ensures the system continues to accurately convert NLQs to SQLQs even as medical or domain-specific ontologies evolve, without requiring complete reconfiguration of the conversion system.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS20250013636A1Converting natural language queries to SQL queries using ontological codes and placeholders
Publication Date: 2025.01.09 AMAZON TECH INC
  • US20250013636A1 patent drawing
  • US20250013636A1 patent drawing
  • US20250013636A1 patent drawing

AI summary

An NLQ-SQLQ tool or service of a provider network may receive a natural language query (NLQ) from a client and convert the NLQ to an SQL query using ontological codes and placeholders. For one or more portions of the NLQ, the tool/service determines that the portion is associated with one or more codes of an ontology. The tool/service then assigns, based on criteria, a particular code to the portion. The tool/service replaces portions of the NLQ with different argument placeholders to generate a modified NLQ. A trained model converts the modified NLQ into an initial SQL query that has argument placeholders and subquery placeholders. The tool/service generates a final SQL query based on the initial SQL query, predefined SQL subquery templates associated with the subquery placeholders, and codes associated with the argument placeholders. The tool/service executes the final SQL query and sends results to the client.