Storing XQuery files as *.xq

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Storing XQuery files as *.xq

Daniel E. Renfer
Hello,

    I am rather new to OPS, and am trying to send XQuery to an eXist
database. I've gotten everything working by embedding my query in the
'query' input to the 'oxf:xmldb-query' processor, (like in the DMV
example) but what I want to do is store my queries in *.xq files. (in
'model/xqueries/')

I've tried several different things, from xslt to xinclude to identity,
but I can't seem to get it right. Can anyone give me a quick example on
how to read in a *.xq, wrap it in a xdb:query, (the collection is always
the same) and pass it off to the oxf:xmldb-query processor?

Many Thanks,
Daniel E. Renfer (http://kronkltd.net/)



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Storing XQuery files as *.xq

Erik Bruchez
Administrator
Daniel,

The problem is that a .xq file is not an XML file. Currently, the XML:DB
processors only support XQuery embedded within XML, as you have seen.

One solution would be to update the XML:DB processors to support loading
external queries. I have added a bug for this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=304672&group_id=168&atid=350207

Another, temporary solution would be for you to write some code to
process .xq files. You could use the URL generator to read the file as
text, forcing the content-type to text/plain. Then with the XSLT
processor, prepend "<root>" to the string read, append "</root>", and
use saxon:parse to try to parse the resulting file as XML. Then feed
this enclosed into an <xdb:query> element to the XML:DB processor. Not
trivial, but in principle it should work.

-Erik

Daniel E. Renfer wrote:

> Hello,
>
>    I am rather new to OPS, and am trying to send XQuery to an eXist
> database. I've gotten everything working by embedding my query in the
> 'query' input to the 'oxf:xmldb-query' processor, (like in the DMV
> example) but what I want to do is store my queries in *.xq files. (in
> 'model/xqueries/')
>
> I've tried several different things, from xslt to xinclude to identity,
> but I can't seem to get it right. Can anyone give me a quick example on
> how to read in a *.xq, wrap it in a xdb:query, (the collection is always
> the same) and pass it off to the oxf:xmldb-query processor?
>
> Many Thanks,
> Daniel E. Renfer (http://kronkltd.net/)



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