We did (briefly) look at http://chaperon.sourceforge.net/ to do something similar but likewise didn't get very far (due to time)... Matthew > -----Original Message----- > From: SRU (Search and Retrieve Via URL) Implementors > [mailto:[log in to unmask]] On Behalf Of Mark R. Diggory > Sent: 15 February 2006 16:05 > To: [log in to unmask] > Subject: Re: SQL as XML > > Mike, > > Is your CQL parser Antlr or JavaCC based at all? I've been > experimenting with using these lexical parsers to build > parser with other query languages but without significant > success. I'm thinking an alternative here is to use Antlr or > JavaCC, to build a parser generation "framework". Then cases > such as this can extend the parser generation with handlers > for their implementation, the simplest example implementation > would be A SAX event generator. Since these tools are > specifically designed to handle query parsing and usually are > tailored to working with BNF like syntaxes, getting from the > CQL spec to an actual implementation could be automated. > > -Mark > > Mike Taylor wrote: > > Date: Wed, 15 Feb 2006 09:51:31 -0500 > From: Rafe Rosen <[log in to unmask]> > <mailto:[log in to unmask]> > > Sorry, my bad, I should have been more clear, > > My project is implementing a CQL interface to > our database of > 160,000 recordings of animal sound and video. > My task is to build a > system that translates a CQL query entered by a > human into an > appropriate (and potentially complex) SQL > select statement to be > sent to the database. Since there is (was?) an XML-CQL > representation, and XML is pretty pervasive, I > figured if there was > a similar schema defined for SQL I could to the > transformation with > XSLT. > > > > Oh, I see. Well, that makes sense. But -- > > > > I have since been advised that the above > strategy is a Bad Idea. > > > > I'd have to agree. I think it would be going too far around the > houses, and that you'll need the idiomatic power of a Proper > Programming Language to do the job well, rather than the > > super-powerful-in-the-right-context-but-unwieldy-otherwise wonder that > is XSLT. > > > > I'm probably going to use the parse tree > structures created by > CQL-java (for CQL) and either ZQL or hibernate > (for SQL). > > > > That sounds like a more promising approach. > > > > If anyone on the list has experience > translating CQL to SQL, I would > love to hear about it. > > > > Part of the trick is translating from abstract CQL indexes to > correponding SQL columns. Another issue is that often > you need to > make joins in the SQL that don't directly correspond to > anything in > the CQL. It's one of those jobs that's fraught with > many tiny issues > that you can't see coming until you trip over them. > > Good luck :-) > > > > And what is the exact status of XCQL? I'm > pretty new on this list > and hadn't heard it had been dropped. > > > > At one stage, it was possible (in SRW, and perhaps in > SRU though it > would have been terrifyingly ugly) to submit the query > in XCQL instead > of CQL. That facility has now been withdrawn. Where > XCQL _is_ still > used is in echoing back the compiled query; but that > doesn't help you > at all if you're a server implementor. Full details at > http://www.loc.gov/standards/sru/ > and the linked pages. > > _/|_ ________________________________________________________________> ___ > /o ) \/ Mike Taylor <[log in to unmask]> > <mailto:[log in to unmask]> http://www.miketaylor.org.uk > )_v__/\ "_Apatosaurus_ sort of looks like a pro > wrestler when most of > the other sauropods tend to look like > ballerinas" -- Matt Wedel. > > >