Hi,
I am writing a RNG schema for the RDF/XML query language I have shown at
eXtreme this year
(http://dyomedea.com/papers/2005-extreme/xmlRdfQbe.html).
This query language is based on QBE (Query By Example) which means that
to query a vocabulary, you are giving samples of XML results and it
could seem a good idea to try to reuse the schema of the vocabulary used
by the documents that are queried to build the schema of the QBE for
that vocabulary.
However, we face the same kind of issues than when we try to create a
schema for XSLT tarnsformations that generate XHTML out of a schema for
XHTML and I don't think that this can efficiently be done with RNG (even
with the help of NVDL.
Let's suppose we have a simple target schema such as this one :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
start = element root { root.content }
text-content = xsd:token
root.content = (
foo1 |
foo2
) *
foo1 = element foo1 { foo1.content }
foo1.content =
bar1? &
baz1 &
bat
foo2 = element foo2 { foo2.content }
foo2.content =
bar2 &
baz2? &
bat *
bar1 = element bar1 { text-content }
baz1 = element baz1 { text-content }
bar2 = element bar2 { text-content }
baz2 = element baz2 { text-content }
bat = element bat { text-content }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The QBE for this language would be:
The same root element with a "select" element mandatory and that can
happen at any location but only one.
This first step is easy to solve by combining a reference to that
element by interleave :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
root.content &= q.select
q.select = element select {q.select.content }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This select element has a what and a where sub element:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
q.select.content = q.what? & q.where
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far so good, the troubles are starting right now!
The content of the what element is any of the top level element (without
the select that we've just added), with a content model that is any of
their child element appearing at most once and made empty.
In other words, the schema for what should be equivalent to:
q.what = element what {what.content}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
what.content =
element foo1 {
element bar1 {empty}? &
element baz1 {empty}? &
element bat {empty}?
} | element foo2 {
element bar2 {empty}? &
element baz2 {empty}? &
element bat {empty}?
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The content of where is still more challenging and I won't go into its
detail (at least until someone solves this first one)...
Despite the many possibilities opened by RNG and NVDL, I don't think we
can derive what.content from building blocks of the original schema...
The only solution I see is to write a XSLT transformation (working on
the simplified version of the RNG schema so that it is independent of
its syntactical variation) that generates the schema for the QBE.
Does anyone have a better idea?
Thanks,
Eric
--
Le premier annuaire des apiculteurs 100% XML!
http://apiculteurs.info/
------------------------------------------------------------------------
Eric van der Vlist http://xmlfr.org http://dyomedea.com
(ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/2U_rlB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/rng-users/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/