OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: SQL queries expressed in XML

[ Lists Home | Date Index | Thread Index ]
  • From: Andrew McNaughton <andrew@squiz.co.nz>
  • To: Leigh Dodds <ldodds@ingenta.com>
  • Date: Tue, 23 Mar 1999 06:26:54 +1200

> > we recently had the idea to use XML to express SQL-like queries
> > (so this is
> > not about querying XML -- it is about using XML to express queries). It
> > seems to me that we might not be the first ones; so has anybody defined an
> > XML document type for expressing SQL queries?
> 
> And just to widen this question slightly - assuming I do have an XML
> representation
> of a language construct - whats the best way to do the conversion from
> the XML representation to the 'correct' language representation.
> 
> Could I use XSL to do this - or would this be going against the grain?
> 
> (Just to qualify this I'm relatively new to XML, and *extremely* new to
> XSL).

XSL doesn't seem to do very well where the desired output is not well formed.  
If your SQL queries have '"', '<', '>' or '&' in them, then you're going to 
start getting into kludges.  perl or DSSSL would be better suited to the task.

*Why* do you want to put your queries into XML?  Do you need access to the 
structure of your queries?  Perhaps you just need something that can be 
embedded comfortably in your XML documents.  What you are trying to achieve is 
likely to affect how you approach the problem.


I've got a problem to tackle soon which provides an example of a reason one 
might want to have queries in an XML format, and the implications it has for 
encoding of my queries.  It may be that others are doing similar stuff - if so 
 I'd like to hear about it.

I have a steady flow of news material coming through my site.  I have 
subscribers who receive material filtered from this according to custom 
preferences.  Whenever a story comes through I need my system to turn around 
several thousand queries within a few minutes at worst (while not unduly 
slowing my web server). I want to offer more flexible customization than I 
have at present.

Basically what I need to do is to invert the problem and define a query based 
on the story data which can be applied to the stored queries to find the set 
of queries which the story matches.  (Did that make sense?)

XML expression of queries appeals since it facilitates interchanging of 
queries and data.  The XML query languages I'm aware of don't seem helpful 
though, as they tend to store query expressions as CDATA and  don't expose the 
query structure.

The sort of queries I want to do are boolean logic queries.  Primitives I need 
are literal specification of element content or attribute content, or 
containment of particular words within the element contents.  Extensions of 
this boolean model might include stemming (reasonably likely) and use of term 
weighting (probably not).  These are amply discussed in the Information 
Retrieval literature for those who don't know about them.

I figure any boolean query can be expressed as a decision tree terminating in 
true or false leaf nodes, that this maps well into XML, and that it should be 
able to be used to search for queries matching a given document using existing 
tools (eg sgrep).  I believe this could lead to a relatively simple processing 
model, but it remains to be seen how efficient it will be.

If anyone is aware of any relevant work that is being or has been done I'd 
appreciate hearing about it.  XML or otherwise.

Andrew McNaughton










-- 
-----------
Andrew McNaughton
andrew@squiz.co.nz
http://www.newsroom.co.nz/



xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS