XQuery was designed from the ground up to process XML, but it is still missing capabilities that a hierarchical query processor product should have. SQLfX®has these hierarchical query capabilities and we list these hierarchical query capabilities in SQLfX® and compare them to XQuery below. A Specific Isolated Query Specification SQLfX® uses ANSI SQL’s simple straight forward query specification of SELECT, FROM, and WHERE to specify the SQL native XML hierarchical query nonprocedurally without requiring any procedural logic. Changes and additions can be made easily. The user does not need to know the structure of the structure being processed or how to access a database structure.
Much has been made of XQuery’s close mapping to SQL’s SELECT, FROM, and WHERE, but XQuery’s comparable SELECT and FROM operations are deeply embedded within XQuery’s looping logic. XQuery uses procedural logic with the use of its FOR and LET statements that use looping constructs that also require procedural logic to code. In addition, the selected data for output is embedded in strategic locations throughout the looping logic. This indirectly specified query is embedded in the processing logic and any changes have to be reprogrammed. The query user has to know the structure being accessed and be familiar with access techniques of hierarchical databases. Variable Query Processing With theSELECTList
The SELECT list of SQLfX® can be used to quickly and dynamically specify the desired output data which automatically controls the specific range of processing necessary to satisfy the query request. Adding or removing selected data items can automatically add or remove access to different portions of the structure’s processing.
XQuery query additions to modify what data is desired may require changes to the looping processing logic requiring coding changes in the logic of the query. This may then require re-testing. Nonprocedural Navigationless Operation
The nonprocedural and navigationless operation of SQLfX® means that no procedural navigation by the user is necessary. The user can be non technical and have no knowledge of the structure’s structure is necessary.
XQuery requires procedural XPath navigation which is a form of procedural logic that requires knowledge of the structure being processed and how to navigate the structure. Full Nonlinear Principled Hierarchical Query Processing
SQLfX®’s hierarchical processing has evolved its processing from simple linear single-leg hierarchical processing to fully principled multi-leg nonlinear hierarchical processing. This enables many new capabilities that make more uses of the customer's data and greatly increases the power of the query, data value, and the number of different queries possible.
XQuery can not realistically process multi-leg queries because it uses procedural navigation which becomes too complex to perform procedurally for nonlinear hierarchical processing. Multi-leg processing requires following specific hierarchical processing principles and logic that can quickly become very complex requiring exact coding requirements. These become increasingly complicated with multiple layers and combinations of hierarchical processing procedures as the number of legs referenced increases. Structure Aware Operation
The FROM clause of SQLfX® specifies the input source objects and how they are related hierarchically using the Left Outer Join. This allows SQLfX® to analyze the Left Outer Join hierarchical data modeling usage to dynamically determine the exact hierarchical structure being processed. This allows SQLfX® to be aware of the hierarchical structure and to naturally enhance and extend its hierarchical structure processing control. It will not let the user specify a structure that is not hierarchically correct guaranteeing the results are always hierarchical correct.
XQuery is unaware of the structure of the data it is processing. Another surprise is that XQuery supports operations like its default Inner Join which is not a hierarchical operation and will invalidate hierarchical structures. It can produce results that are not hierarchically correct and can not dynamically enhance the query hierarchically. Since XQuery is unaware of the structure it is processing, it can not give a warning when hierarchical processing errors occur which is quite possible with its procedural processing. Hierarchical Global Views and Optimization
SQLfX® supports ANSI SQL hierarchical global views. These views are comprised of Left Outer Joins whose syntax and natural hierarchical use define entire nonlinear hierarchical structures. This knowledge of the hierarchical structure is valuable metadata that allows the views to be dynamically optimized hierarchically based on the query’s selected data for output. This powerful semantic optimization removes hierarchical paths of the processed structure that do not require access for the active query. This means that global views can be supported and will have no additional overhead since each query is optimized to the query, accessing only the necessary portion of the hierarchical structure to satisfy the current query. This allows a single reusable global view for querying any single or multiple leg query contained in the global structure.
Since XQuery is not aware of the structure it is processing, it does not know if the structure is hierarchical, so it can not hierarchically optimize hierarchical structures and global views. Non hierarchical structures require that all paths of the structure to be accessed to preserve the validity of the view. This is because missing data anywhere in the view can affect the results even if the data was not referenced. This limits XQuery to performing optimizations at the logical operational level and not at the more powerful hierarchical semantic level. This also means that every different query access plan has to be specifically defined by its procedural navigation. This significantly limits XQuery’s query reuse.
Automatic Structured XML Output
Since SQLfX® is fully aware of the hierarchically processed result and what output data has been selected; it can automatically format the result as fully hierarchically structured XML output. Required transformations can be specified in ANSI SQL if needed. The structure of the XML result will automatically adapt to changes in selected data that follows standard hierarchical processing operations like automatically performing node promotion around nodes not selected for output. Nodes that have no data selected are sliced out of the structure, but their descended nodes are preserved if they have data selected. This is standard hierarchical formatting processing, which can be overridden if necessary to force empty nodes to be output. XQuery’s output formatted XML output is specified more formally and is more fixed. There is no default structure formatting because XQuery does not know the structure. Any dynamic changes in the output need to be programmed and tied to the processing logic. Effective Interactive Use Since SQLfX® is fully nonprocedural, navigationless, and automatically formats the XML hierarchical output; it can support interactive use effectively. In addition, the advanced multi-leg query processing automatically increases the value of the data allowing for a higher level of processing which can be used in decision support. Global views also greatly increase the ease and value of interactive use because they allow unlimited query specifications from the same view.
XQuery’s procedural logic and navigation greatly limits its practical use for interactive operation. It is too programmatical to effectively specify interactively. Conclusion SQLfX® is nonprocedural allowing it to: be used by untrained personnel, support full unrestricted multi-leg queries, always produces correct XML hierarchical results automatically, and can be used interactively. XQuery’s operation is procedural and can not support these capabilities. In reality, XQuery is not truly a query language. It is actually a high level procedural language that allows exact and flexible control not possible with a nonprocedural language like SQLfX®, but it is marketed as a nonprocedural query language.