Project

Profile

Help

XQuery as XQueryX

Added by Anonymous almost 17 years ago

Legacy ID: #4710852 Legacy Poster: Chapman Flack (jcflack)

Hi List, As I seem to have wandered into the territory of nontrivial enhancement ideas with my last post, I guess I may as well throw out another. :) I think it would be cool to be able to obtain an XQueryX document representing a query that's been parsed. Maybe that could be as (conceptually, if not practically) simple as refactoring the Java code so that the parser for XQuery (human-readable) syntax looks like a SAX XMLReader producing XQueryX, and then the rest of the analysis and compilation is driven by that. Then a Java program embedding Saxon could interpose some interesting transformations at that point. An example that would tickle me especially would be to replace certain direct element constructors with constructors for more specialized things, e.g. let $dn := <jndi:dn> <jndi:rdn cn='Bond, James'/> <jndi:rdn ou='MI6'/> <jndi:rdn co='uk'/> </jndi:dn> ==> let $dn := jndi:make-dn(<jndi:dn>...</jndi:dn>) treat as java-type:javax.naming.ldap.LdapName Such a transformation would be easy, if things were just factored so the query was available in XQueryX form. OR ... have I just missed something, and might there already be some way to accomplish this? Chapman Flack


Replies (5)

Please register to reply

RE: XQuery as XQueryX - Added by Anonymous almost 17 years ago

Legacy ID: #4713555 Legacy Poster: Michael Kay (mhkay)

I've thought about this in the past. Producing XQueryX as a direct representation of the source XQuery tree doesn't seem to add value. You can get that out of the W3C XQuery parser already, I see no value in reproducing that. Producing XQueryX as a representation of the optimized expression tree doesn't really work because the expression tree uses a variety of internal expression types that don't correspond directly to anything in source XQuery or XQueryX. That's why I decided not to use XQueryX as the output from the -explain option.

RE: XQuery as XQueryX - Added by Anonymous almost 17 years ago

Legacy ID: #4714897 Legacy Poster: Chapman Flack (jcflack)

How about accepting XQueryX as input (or a SAX XMLReader synthesizing XQueryX)? Then at least, I could do the sorts of transformations I'm thinking of as . W3C XSLT . parser style SAX XQuery -> XQueryX -> XQueryX' -> Saxon-internals instead of what would now be required . W3C XSLT XSLT Saxon's . parser style style parser XQuery -> XQueryX -> XQueryX' -> XQuery' -> Saxon-internals I am sure that neither the W3C parser nor Saxon's is a tiny piece of code, and something strikes me as unlovely in packing both into one application. (Oh, do I now have to accommodate two mechanisms for reporting parse errors, for example?) That's where I think the added value would lie if this could be done less circuitously. -Chap

RE: XQuery as XQueryX - Added by Anonymous almost 17 years ago

Legacy ID: #4714907 Legacy Poster: Chapman Flack (jcflack)

apologies for the garbled ASCII art above; I had noticed the forum eats indentation, but I didn't realize it compressed all intraline spaces as well.... -Chap

RE: XQuery as XQueryX - Added by Anonymous almost 17 years ago

Legacy ID: #4714926 Legacy Poster: David Lee (daldei)

I agree with jcflack. While I certianly am not volunteering (yet) to write the code, and sympathize with the effort ... I do see a value-add in supporting XQueryX both as input and output for exactly the reasons given : A) Less dependancy on (possibly conflicting) XQuery parser libraries ---> Already adding saxon to my classpath somehow gets it involved in other XML parsing code unexpectedly and magically ... I dont want to worry about yet another library. B) XQueryX Input (either/or/and as text, sax, or DOM ... avoid a round-trip to text even if another library was leveraged). and even ... C) Maybe Mr Kay's experiments into XSLT transformations to optimize XSLT source might just naturally fit into this ! (yea I know, thats a streatch goal). -David Lee

RE: XQuery as XQueryX - Added by Anonymous almost 17 years ago

Legacy ID: #4716681 Legacy Poster: Michael Kay (mhkay)

There's a stylesheet that converts XQueryX to XQuery, and it should be pretty easy to plug this in as a preprocessor in front of Saxon's XQuery parser. So I don't think anything special is needed to make Saxon accept XQueryX input. Of course one problem will be that any error messages are pretty difficult to decipher. Michael Kay

    (1-5/5)

    Please register to reply