XQuery to SQL Rewriting for Dynamic XML Type Handling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems face challenges in efficiently executing XQuery queries on dynamically typed XML data, as the data type is unknown at compile time, preventing the use of SQL summation operators and requiring dynamic type determination at runtime.
Innovation Solution
Rewriting XQuery queries into SQL constructs using SQL polymorphic functions, where XML data is typed as XMLType, allowing for static typing and type checking, enabling the execution of dynamically typed XML data with SQL polymorphic functions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If XQuery queries are executed directly on dynamically typed XML data, then the queries can handle semi-structured data with unknown types at compile time, but the execution efficiency decreases and SQL operators cannot be used
Solution Approach 1:
The patent introduces an intermediary type system (XMLType with static type definitions) that mediates between the dynamic nature of XML data and the static typing requirements of SQL operators. This allows XQuery queries to be compiled into SQL while maintaining type safety through the intermediary type layer.
Solution Approach 2:
The patent performs preliminary type determination during query compilation by analyzing XML schemas and data type annotations before execution. This preliminary action enables the system to resolve dynamic types into static types that can be used by SQL operators, improving execution efficiency.
2Productivity
If SQL operators are used for XML data processing, then query execution efficiency improves, but the data type must be known at compile time which limits handling of semi-structured data
Solution Approach 1:
The patent creates a universal type system (XMLType) that can represent multiple XML data types (element, attribute, text, etc.) and works with both structured and semi-structured data. This universal approach allows SQL operators to handle diverse XML data types through a common interface.
Solution Approach 2:
The patent changes the type parameter from dynamic (determined at runtime) to static (determined at compile time) by introducing type inference mechanisms that analyze XML schemas and data annotations during query compilation, enabling SQL operator usage while maintaining versatility.
3Productivity
If static typing is enforced during query compilation, then SQL operators can be used for efficient execution, but the system cannot handle XML data with unknown or variable types
Solution Approach 1:
The patent performs preliminary type analysis during query compilation by examining XML schemas, data type annotations, and sample data to determine static types before execution. This preliminary action enables the system to enforce static typing while maintaining the ability to handle dynamically typed XML data through intelligent type inference.
Data Source
AI summary
XQuery queries that include functions that operate on dynamically typed XML data are rewritten into compilable SQL constructs. XML data that is dynamically typed is XML data for which a specific XML data type cannot be determined at compile time and in fact may vary. In general, XQuery queries are rewritten into SQL queries that use SQL constructs in lieu of XQuery constructs. The SQL constructs include an “SQL polymorphic function” that is defined or recognized by a database system as valid syntax for an SQL query. The rewritten query applies the XML data to the SQL polymorphic function, but the XML data has been typed as XMLType, a data type recognized by SQL standards.


