logo       

XQuery-Schema integration: msg#00217

text.xml.exist

Subject: XQuery-Schema integration

Hi all

while trying to come up with some solution that would allow XPath
queries to schemata stored in eXist (those queries should not return
blank XML but a Java representation so that the result is easily
useable), I discovered that this will probably lead to writing
classes that represent schema. I could not find any existing
libraries that would be capable of receiving an XPath expression and
returning part of a schema (XMLBeans looked promissing, but their
support for XPath is extremely limited, I would like to use eXist's
query processor for orthogonality reasons).
That said, my first attempt was to just use JAXB to run it over XML
Schema. Then I realized that XQuery also has schema support, but that
the datamodel used in XQuery is a bit different (but you can
convert). This leads to a couple of suggestions:

- Use the XQuery type system to internally represent schemata. There
are conversion rules for XML Schema in the XQuery specs.

- Write our own validator (this task is greatly simplified if the type
system is that of XQuery and not XML Schema). Rolling our own seems
like reinventing the wheel, but it would be able to do one-pass
validation because it knew about the eXist schema store (and thus
could ask for elements on the fly). Currently (using Sun's MSV) we
have to do two-pass validation because you have to hand all the
necessary schemata to the MSV beforehand. If anybody knows a
validator we could use, PLEASE come forward!

- Make the result of the validation (i.e. the type of the element)
persistent. This way you only need to revalidate what is changed when
you update a document. The XQuery implementation also could take
advantage of this in the long run (e.g. XPath steps could prune
results early).

To implement this, the next steps would be:
- add the schema syntax to the XQuery implementation. Looking at
XQuery.g I honestly have no idea how to do this :-(
- implement the conversion from XML Schema to XQuery typing and store
schemata in XQuery format internally.
- write our own parser based on the XQuery schemata (this means
implementing XQuery's "validate").

This is clearly not an option for beta-2. I don't know whether schema
support would make it into release-1.0.
What do you think?

Sebastian

--
Sebastian Bossung
Software Systems Group (4-02)
Hamburg University of Technology
Harburger Schlossstrasse 20, 21071 Hamburg, Germany
http://www.sts.tu-harburg.de/~se.bossung


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise