logo       

Re: XQuery-Schema integration: msg#00225

text.xml.exist

Subject: Re: XQuery-Schema integration

Hi Sebastian,

> 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!

Not a validator, but have you checked IBM's xsd library which is part of
eclipse?

http://download.eclipse.org/technology/xsd/scripts/docs.php?doc=references/articles/dwtip1-scpw/index.html

As far as I can see, its main purpose is to query schema information, not to
validate or provide a PSVI. I would be interested to hear your opinion on
that.

> - 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).

I would really like to have type information attached to the persistent DOM as
that would open many new possibilites. Only problem is how to store this
information efficiently.

> 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 :-(

What exactly do you mean by "schema syntax"? Things like "validate" or
"import"? I can add dummy rules for these to XQuery.g. We can then start to
fill them out.

Wolfgang


-------------------------------------------------------
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