Abstract

The present disclosure relates to a method and a system for converting Natural Language Query to Structured Query Language (NQL-to- SQL) with automated content generation. The present disclosure suggests receiving a natural language query from a user. Thereafter, the present disclosure suggests processing the query through an automated metadata factory that maintains pre-built indexes, including a hash index for O(1) constant-time keyword lookups, a vector database for semantic similarity search, a knowledge graph for entity relationships and join paths, and a constraint store for business rules. Subsequently, the present disclosure suggests generating a Semantic Query Plan (SQP) as a database-agnostic intermediate representation and synthesizing optimized SQL using a hybrid approach combining template matching and LLM-based generation with cost-aware model routing. Further, the present disclosure suggests executing the SQL and validating results through multi-layer validation. As a result, continuous learning from the query outcomes to improve performance.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.

Share

COinS