The SQLfX® ANSI SQL query example diagrammed below naturally involves most of the features and capabilities previously identified on this web site. These include: natural SQL reference to native XML data types, logical and physical data modeling, hierarchical modeled SQL views, joining heterogeneous data structures, complex multi-leg hierarchical semantics, full multi-leg hierarchical processing, hierarchical optimization, node promotion, and input structure semantics is preserved through to the result.
The SQLfX® XML enabler middleware operates on the SQL customer’s SQL processor and automatically presents this combined integrated processing as shown in the diagram below.
In the example below, the left Outer Join operation is used to hierarchically model a physical native XML structure and a logical relational hierarchical structure. Notice how the SELECT and WHERE clause qualification produce an accurate hierarchical result. The “D1” qualified data node has been Selected along with its hierarchically related “L” node data occurrences. The result is both hierarchically and relationally accurate. Because the XML result format can represent the hierarchical structure, its resulting hierarchical structure can be stored with its data result, thus preserving its hierarchical semantics which is of crucial importance for XML support.
To perform this automatic hierarchical processing, it is necessary to dynamically determine the structure of the unified data structure being processed. This dynamic and seamless metadata structure extraction capability has been developed and patented by Advanced Data Access Technologies Inc. and incorporated into SQLfX®.
The invoking ANSI SQL query shown in the diagram above automatically brings about a significant number of hierarchical processes which were listed in the previous paragraph. Also notice the non procedural ease, power, and intuitiveness in defining and joining structures, and selecting data across multiple legs. The XML view above could have been automatically defined from an XML DTD or schema and the Table view creation could have been aided by a GUI. When these hierarchical views are expanded in place, the resulting SQL will model the virtual and unified data structure being processed, as shown above. The dashed boxes in the virtual structure shown represent unselected nodes that will not be copied to the result structure causing node promotion. The dashed boxes connected by a dashed line are not referenced and are not on a path to a referenced node, enabling a hierarchical optimization where they are removed from all access consideration.
Using the same views of this query, any valid query can be dynamically specified and the processing will be automatically performed efficiently. The semantics necessary for this non procedural processing are automatically determined by the hierarchical structures’ metadata found in the views. Only paths necessary will be accessed due to SQLfX®’s hierarchical optimization. This means with a single global view all queries are optimally optimized. With XQuery, this processing semantics needs to be specified procedurally in its views for the specific subviews that are necessary for the query. The difference is that SQL hierarchical views automatically include the hierarchical semantics of the structure allowing all queries to be dynamically processed nonprocedurally. XQuery uses code (functions) views to explicitly specify the required semantics which can only apply to a limited range of query usage at a time.
XQuery would also require complex user supplied procedural code to perform the coordination between the multiple legs being processed. This procedural code can also increase the chance of logic and programming errors. SQL does the multi-leg processing automatically for the user.
In order to assist the SQL processor to handle even more advanced nonlinear hierarchical features and XML support in the future, transparent replacement of the relational engine by a hierarchical engine will be possible in the future as shown in the above diagram.