Thursday, February 14, 2008

RMOUG TD 2008 Answers to XQuery Questions

I finished my two presentations at Rocky Mountain Oracle Users Group (RMOUG) Training Days 2008 over the past two days. The group that attended the Apache POI presentation was relatively small and did not have many questions during or after the presentation. The group at the XQuery presentation, however, was much larger and had many questions during and after the presentation. This blog entry covers some of these questions and the answers.

Before getting into some of the questions that were asked along with answers to them and additional references associated with them, I'd like to thank all those who attended my two presentations and especially thank those who asked questions.

How do you use Oracle's proprietary ora:view function with more than one table (joins)?

To this question, I answered that the only way that I could think of and had seen to do this is to use ora:view on a Oracle database view. This appears to be the appropriate answer as documented in the Using XQuery with Oracle XML DB document.

Can you query the contents of Microsoft Office documents with XQuery?

It is possible to use XQuery to query the contents of Microsoft Office 2007 documents (or documents saved in the Office Open XML format using the available converters for older versions of Office applications). In fact, this is documented in the article XQuery Your Office Documents. Note, however, that this requires that the XQuery engine be able to open ZIP files and I have not been able to find a way to do that automatically with Oracle's XQuery implementation. One could still open the Office Open XML ZIP file in another way (using ZIP utility or JAR or similar mechanism) and then XQuery the contents.

The meeting participant who asked this question needs to query Office applications data prior to the Office Open XML format, so I told her that XQuery will not be able to help here. While my other topic at this conference (Apache POI) is useful for reading Excel, it does not work natively out of the database like XQuery does with Oracle's XQuery implementation.

How do you use XQuery with an XMLType Database Column?

Although I had many XQuery examples in my presentation, I did not specifically demonstrate the use of the SQL/XML standard XMLQUERY on an XMLTYPE database column. Fortunately, a good example of this is demonstrated as Example 18-8 in the Using XQuery with XMLType Data section of the Using XQuery with Oracle XML DB chapter of the Oracle XML DB Developer's Guide 11g. The key to this is the use of the PASSING clause.

How do you terminate an XQuery expression?

I think I may have misunderstood this question and given an answer to a different question. I think what the attendee was asking is how one could have multiple XQuery statements in a single document running procedurally. It is important to note that an XQuery Scripting Extension is currently under work in the Worldwide Web Consortium (W3C). The XQuery Prototype with XQLPlus README document discusses using an XQuery .xql file. Perhaps the best example of complex XQuery used similar to XSLT is the article Generating XML and HTML with XQuery. This example uses XQuery custom functions embedded within a master XQuery expression. In other words, with XQuery, nesting XQuery expressions is the approach often used to build elaborate transformations.

Finally, the Querying XMLType Data section of the article Querying, Constructing, and Transforming XML with XQuery also shows how nested XQuery expressions can be used in transformation.

Is Apache POI Related to or Dependent On Apache HTTP Server?

For those of us who use several Apache products, this is an easy question and answer. However, I thought it was a good question that reminds me that many in the IT community, especially those outside of the Java development community, may not be as familiar with the Apache Software Foundation. Just as Oracle Corporation is still most often associated with database products by many DBAs and developers, it is likely that Apache implies HTTP server (or perhaps Tomcat servlet container) to many people as well. I pointed out that not only is Apache POI not dependent on Apache HTTP server being present, but that they in fact have very little to do with each other besides their common "Apache" name.

UPDATE (16 February 2007): The following are some other accounts in the blogosphere regarding recently concluded RMOUG Training Days 2008.

RMOUG Training Days 2008 Starting -- Alex Gorbachev

First Day at RMOUG -- Babette Turner-Underwood

RMOUG Day 2!! -- Babette Turner-Underwood

RMOUG 2008 is Over -- Alex Gorbachev

George Trujillo on RMOUG Training Days 2008
* "RMOUG - Excellent Ending, Now on to Collaborate 2008 in Denver"
* "RMOUG Training Days - February 13, 14 2008 in Denver, CO"
* "RMOUG 2008: MySQL and Oracle Fusion Middleware Presentations"

Can a Performance Tuning Tool be Complete?

No comments: