Why XQuery?

XQuery is a programming language designed for processing XML and other semi-structured data. Endeca has added an XQuery evaluator to the MDEX Engine for a number of reasons.

Principally, XQuery is a language designed to make it easy to manipulate XML fragments and other structured and semi-structured data that can be represented as XML. It is more convenient to manipulate XML (and therefore record results, dimension trees, and whatever else the MDEX Engine might return) in XQuery than it would be to do so in SQL, Java, .NET, or Perl.

XQuery is also a W3C standard, with rigorously defined and tested semantics. This allows MDEX developers to benefit from the body of practice surrounding XQuery. The XQuery language is extensible via external functions, pragmas (implementation-specific language extension facilities), and library modules.

In addition to the ease with which XQuery lets you manipulate XML, the benefits of XQuery include the following:

Exposing your custom XQuery main modules as Web services may also provide performance benefits. It can save the cost of network transfer in application instances where multiple round trips to the MDEX Engine are required. The data is handed to the XQuery runtime by the MDEX Engine by way of an in-memory data structure, which is faster than marshaling results, sending them over the wire, unmarshaling the results, and manipulating them in the client application. There may also be a caching benefit in cases where a load balancer directs queries at random to numerous Dgraphs, because all of the requests to the MDEX Engine from a single Web service call will execute in the same Dgraph.