Dec. 23, 2009, 1:20 a.m.
posted by pitbull
The Common Query ArchitectureThe diagram in Figure is the best way to describe what the Common Query Architecture is all about. (Note that some of the classes in the diagram are internal in the Technology Preview release.) For each supported XML query language, there is a compiler that generates an intermediate query language representation, as is represented by the XmlExpression class. 7. The Common Query Architecture showing multiple XML query languages
Multiple XmlExpression instances can be composed together, meaning that a query—once compiled—can be used as input to another query. This is epitomized by the XmlViewSchema class, which represents an XML view. In effect the XML view is compiled just like any other XML query language and composed into an XQuery whenever the map:view() extension function is used. The intermediate format provides an abstraction layer for any XML query language. After compilation and composition, the query engine takes over. Here optimizations of the generated query are applied in an identical fashion to SQL query rewrites in a relational database, in order to generate a better-performing and hence more optimal query. These can vary from simple to extremely complex, depending on the query and the types of data sources. The query engine then generates executable MSIL code and SQL statements, if the data sources are targeted at SQL Server, as an XmlCommand class. The XmlCommand class is a query plan that can be cached and executed multiple times against the specified data sources by repeatedly calling the Execute method. The output from the execution is a stream of XML (or other format) via a TextWriter class. Having a query architecture that is common across all the XML query languages means that it can take advantage of language-independent optimizations, and hence provide performance improvements. |
- Comment
