XQuery to SQL Rewriting for Dynamic XML Type Handling

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improveability to handle dynamically typed XML dataVSAvoidquery execution efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

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.

Inventive Principle:
Principle #24Intermediary (Mediator)

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.

Inventive Principle:
Principle #10Preliminary action

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

Engineering Contradiction:
Improvequery execution efficiencyVSAvoidability to handle semi-structured data
Core Design Contradiction:
ProductivityVSAdaptability or versatility

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.

Inventive Principle:
Principle #6Universality (Multi-functionality)

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.

Inventive Principle:
Principle #35Parameter changes

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

Engineering Contradiction:
Improvequery compilation and execution efficiencyVSAvoidhandling of dynamically typed XML data
Core Design Contradiction:
ProductivityVSReliability

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.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS7836066B2Using SQL extensibility for processing dynamically typed XML data in XQuery queries
Publication Date: 2010.11.16 ORACLE INT CORP
  • US7836066B2 patent drawing
  • US7836066B2 patent drawing
  • US7836066B2 patent drawing

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.