Handling LET Bindings in XQuery FLWOR Expressions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current XML pivot join procedures fail to produce expected results when handling LET bindings in XQuery FLWOR expressions, as they incorrectly assume that matches for 'c' and 'd' nodes must be under the same 'b' node, excluding documents that should qualify.

Innovation Solution

An apparatus and method that identify and handle LET bindings in XQuery FLWOR expressions by replicating the LET binding with each next expression step, creating an XPath predicate, and rewriting the XQuery FLWOR expression into an XPath query, allowing the XML pivot join procedure to correctly identify qualifying documents.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the XML pivot join procedure uses the standard XPath evaluation approach where subsequent legs rely on information from prior legs, then the procedure maintains a simple evaluation flow, but documents that should qualify are incorrectly excluded because matches must be under the same parent node

Engineering Contradiction:
Improveaccuracy of query resultsVSAvoidcomplexity of LET binding handling
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the LET binding handling by creating separate binding contexts for each leg of the XPath expression. Instead of maintaining a single evaluation context, the system divides the evaluation into independent segments where each leg can be evaluated against the original FOR binding without relying on information from previous legs. This segmentation allows documents to qualify if any b-node under the a-node satisfies the condition, rather than requiring all conditions to be under the same b-node.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary LET binding context that mediates between the FOR binding and the WHERE clause evaluation. This intermediary context stores the binding information from the LET clause and makes it available to each leg of the XPath expression independently. The intermediary acts as a bridge that allows each leg to access the original binding without being constrained by the evaluation order of other legs.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If the XML pivot join procedure requires matches to be under the same parent node, then the evaluation process remains simple and straightforward, but the procedure produces incorrect results for XQuery FLWOR expressions where matches can be under different parent nodes

Engineering Contradiction:
Improvesimplicity of evaluation processVSAvoidcorrectness of document filtering
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The evaluation process is segmented into independent leg evaluations, where each leg of the XPath expression is evaluated separately against the original FOR binding context. This segmentation removes the constraint that all matches must be under the same parent node, allowing each leg to find matches under different b-nodes as long as they are under the same a-node. The segmentation maintains simplicity by keeping each leg's evaluation independent while improving correctness.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent creates copies of the binding context for each leg of the XPath expression. Instead of having legs share a single evaluation context where subsequent legs rely on prior leg information, each leg receives a copy of the original FOR binding context. This copying approach allows each leg to evaluate independently without being constrained by the evaluation order or results of other legs, while maintaining the simplicity of the evaluation process.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS7698260B2Apparatus and method for handling a LET binding
Publication Date: 2010.04.13 SAP SE
  • US7698260B2 patent drawing
  • US7698260B2 patent drawing
  • US7698260B2 patent drawing

AI summary

An apparatus and method for handling a LET binding used in a WHERE clause of an XQuery FLWOR expression during an XML pivot join procedure. The disclosed apparatus and method enable an XML pivot join procedure to accurately process a query and return one or more qualifying documents. A logical expression within the WHERE clause is identified. Next steps of the logical expression are separated by logical operators. The LET binding is incorporated with each next step. The XQuery FLWOR expression is rewritten using the incorporations along with a FOR binding of the XQuery FLWOR expression to make a syntactically equivalent XPath query. Predicates of the LET binding may also be incorporated with the next steps, without altering the predicates.