Re: newbie

Peter, certainly XQuery may be included in your planned WebServices 
architecture. However you do not need an XML database to implement a so 
called "n-tier" system (of course it is an interesting approach.)

I am also rewriting a system, and I intend to adopt a XML database and 
drop the SQL dbms. I want to show what am I doing, it may help you. My 
application is a content aggregation portal. It allow users to 
consolidate their financial records, e-mail accounts, news providers and 
so on. The application has 3 layers:

	* The user interface portal: a J2EE app using a SQL database
	* The content manager: a J2EE application coordinating
	  data extraction from webservices and delivering html/wml/text
	* The data sources: a hundred webservices doing screen scraping

I will migrate the use interface to an webservices architecture. Instead 
of getting formatted data, the "content manager" will provide XML 
documents. The "user interface portal" will read these and store in an 
XML database for later use.

When an user requests its account summary, the "user interface portal" 
will retrieve the correspondong XML documents from the database, combine 
them in a single document (the page content) and then apply a XSLT 
transformation to deliver the proper mark-up (according to the user-agent.)

Please note this approach *eliminate* the need for XQueryX. Like an SQL 
based application, most queries are ad-hoc. You just pick the right 
XQuery command to extract the desired data.

XQueryX is a great tool for automated query generation, excellent  to 
write application generators and alikes.

What you *do* need to power a XML-based system is a complete data 
manipulation language. XQuery is an excellent query language, with 
strong formal roots (a well defined data model and an algebric 
representation.) Yes, it handle *grouping* and *sorting*.

XQuery is still not a full DML, lacking tools to modify data. The actual 
W3C states clearly:

"164. xquery-updates: Updates

We believe that a syntax for update would be extremely useful, allowing 
inserts, updates, and deletion. This might best be added as a 
non-normative appendix to the syntax proposal, since the algebra is not 
designed for defining this portion of the language."

However to do practical work today you can not wait for this. There are 
some ways to solve this problem. Some are very crude like using queries 
to generationg a new version of a document.  Others are using emerging 
standards, like those provided by the XML:DB consourtium. These are 
being adopted and may influcence the future XQuery extensions for full 
DML support.

Today there are some native (i.e., non relational based) XML databases. 
Most of them still not adopted XQuery, maybe because it is a very new 
standard. For our project we are adopting Apache XIndice, the evolution 
of the dbXml initiative. It do not provide XQuery, but offers XPath 
(tecnically a subset of XQuery) and a XML:DB Java API, also adopted by 
other XML databases. It is a scent of an emerging standard. We evaluated 
another product called eXist, with very similar capabilities.

Of course all of this consolidate in the future with the coming W3C and 
JCP standards. But these are a bit to far away, and the present 
technology is enough to handle requirements of real-world projects.

I hope helped.

*Saran

References
==========


Sample chapter: "From SQL to XQuery"
http://www.perfectxml.com/wp/readchap.asp?CurBook=37

XML:DB Initiative APIs
http://www.xmldb.org/xapi/index.html

Apache XIndice
http://xml.apache.org/xindice/

eXist
http://exist.sourceforge.net/



Peter Foley wrote:
> 
> 
> Hello to everyone on the list. I am currently undertaking a project that is
> looking at replacing a SQL based interface to a complex database system (2-tier)
> with a web services (n-tier) system.
> 
> We are exposing the database objects as XML documents but we do not want to
> populate the whole XML document in order to do queries.
> 
> I am thus thinking about using XQUERY to formulate queries against the XML
> document and converting them via XSLT to SQL. I have tries a few queries and it
> looks feasible (comments welcome) but -
> 
> 1) Is there a tool that converts from XQUERY to XQUERYX (for XSLT to convert)?
> 
> 2) Is XQUERY going to be expanded for Insert, Delete, Update?
> 
> 3) Does XQUERY handle grouping and sorting?
> 
> Thanks for any help.
> 
> 
> 
> 
> -----------------------------------------------
> ABS Web Site:  www.abs.gov.au
> 
> 
> 

Received on Thursday, 13 June 2002 08:17:19 UTC