I am using XQuery like this:
<p:processor name="oxf:xmldb-query"> <p:input name="datasource" href="datasource.xml"/> <p:input name="query"> <xdb:query collection="/db/cms" create-collection="true"> xquery version "1.0"; <news> { for $article in /news/article return $article } </news> </xdb:query> </p:input> <p:output name="data" ref="data"/> </p:processor> Can I move the xquery to an external file so I can do something like this: <p:processor name="oxf:xmldb-query"> <p:input name="datasource" href="datasource.xml"/> <p:input name="query" href="news.xq"/> <p:output name="data" ref="data"/> </p:processor> Also, why do we need the collection attribute? Can you not use the collection() function in the XQuery? What is create-collection attribute for and are there other attributes? Are there other ways to implement XQuery (with eXist and passing data to xsl)? Thanks Jon |
Administrator
|
Jonty wrote:
> I am using XQuery like this: > > <p:processor name="oxf:xmldb-query"> > <p:input name="datasource" href="datasource.xml"/> > <p:input name="query"> > <xdb:query collection="/db/cms" create-collection="true"> > xquery version "1.0"; > <news> > { > for $article in /news/article > return $article > } > </news> > </xdb:query> > </p:input> > <p:output name="data" ref="data"/> > </p:processor> > > Can I move the xquery to an external file so I can do something like this: > > <p:processor name="oxf:xmldb-query"> > <p:input name="datasource" href="datasource.xml"/> > <p:input name="query" href="news.xq"/> > <p:output name="data" ref="data"/> > </p:processor> file. It only supports the query embedded within xdb:query. > Also, why do we need the collection attribute? Can you not use the > collection() function in the XQuery? What is create-collection attribute for > and are there other attributes? I think that the collection is required by the XML:DB API. You can probably use the root collection, /db, if you don't care about passing another collection. Yes, you can use the collection() function. The create-collection attribute creates the collection if it's missing when set to "true". If set to "false" and the collection doesn't exist, then you will get an error. > Are there other ways to implement XQuery (with eXist and passing data to > xsl)? You can submit a query using the REST API, by using the oxf:xforms-submission processor. Note that with the REST API as well, you POST queries in particular collections. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Thanks for clearing that up and taking the time to answer all these queries. It's extremely helpful.
Is there any difference in terms of performance with these two approaches?
|
Administrator
|
Jonty,
On 6/20/07, Jonty <[hidden email]> wrote: > Thanks for clearing that up and taking the time to answer all these queries. > It's extremely helpful. > > Is there any difference in terms of performance with these two approaches? The xmldb-query uses the XML:DB API, which won't go through HTTP. With xforms:submission there will be some overhead as request and response will go through HTTP. If you are using xforms:submission and performance becomes an issue, you can check if this is the bottleneck, and if it is the case switch to xmldb-query. Overall, using xforms:submission has a number of benefits, maybe the most important one being simplicity, so this would be my preferred choice. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Alex,
> On 6/20/07, Jonty <[hidden email]> wrote: >> Thanks for clearing that up and taking the time to answer all these >> queries. >> It's extremely helpful. >> >> Is there any difference in terms of performance with these two >> approaches? > > The xmldb-query uses the XML:DB API, which won't go through HTTP. With > xforms:submission there will be some overhead as request and response > will go through HTTP. If you are using xforms:submission and > performance becomes an issue, you can check if this is the bottleneck, > and if it is the case switch to xmldb-query. Overall, using > xforms:submission has a number of benefits, maybe the most important > one being simplicity, so this would be my preferred choice. you access an embedded eXist database. So I don't think it is a question of overhead (although to be sure we should do some profiling), but rather of architecture, mainly whether you want to have some middleware writting in XPL or whether you want to access eXist directly from XForms. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |