Logic Programming to SQL Translation via Functor Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Structured Query Language (SQL) is limited in functions and operations, making it verbose and difficult to read for complex logic programming tasks, while logic programming languages offer more computational power and readability but are not directly executable on SQL infrastructure.
Innovation Solution
A method to translate logic programming language code into SQL code, using techniques such as functor detection, annotation handling, and transformation into disjunctive normal form, allowing execution on SQL engines and improving compatibility with existing SQL systems.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If SQL is used for querying and managing data, then efficient manipulation of large sets of data is achieved, but the language becomes verbose and difficult to read for complex functions
Solution Approach 1:
The patent introduces logic programming language code as an intermediary layer between the user and SQL. Users write concise logic programming code that is then translated into SQL by a compiler, allowing users to benefit from both the readability of logic programming and the execution efficiency of SQL without directly writing verbose SQL for complex operations
2Adaptability or versatility
If logic programming language is used for complex functions, then computational power and readability are improved, but the code cannot be directly executed on SQL infrastructure
Solution Approach 1:
The patent replaces the need for specialized logic programming execution infrastructure with a translation mechanism. Instead of requiring SQL databases to execute logic programming natively (which would require complex infrastructure changes), a compiler translates logic programming code into standard SQL that can be executed on existing SQL infrastructure, substituting the execution mechanism while preserving the computational capabilities
3Productivity
If SQL functions are used to achieve complex logic programming tasks, then execution on SQL infrastructure is enabled, but the code becomes verbose and requires many more functions
Solution Approach 1:
The patent segments the translation process into distinct phases: parsing logic programming code, detecting functors and transforming them into SQL functions, handling annotations, converting logical operations to SQL operations, and generating final SQL code. This segmentation allows complex logic programming tasks to be broken down into manageable SQL operations that can be executed efficiently on SQL infrastructure
Data Source
AI summary
A method for efficiently translating logic programming language code into structured query language (SQL) code that includes receiving input written in a logic programming language (LPL) that indicates a function that is defined in the LPL, but is not defined in a target SQL used to access a dataset, translating the input written in the LPL into the target SQL to generate translated SQL code, including transforming the function not defined in the target SQL into code for a series of functions that (i) are defined in the target SQL and (ii) together achieve a result of the function not defined in the target SQL, and executing the translated SQL code to achieve a result of the function that is not defined in the SQL, including executing the code for the series of functions that together achieve the results of the function that is not defined in the target SQL.


