XQuery collection() function on Web Dav server

Issues related to W3C XQuery.
proxx
Posts: 6

XQuery collection() function on Web Dav server

Wed Dec 16, 2015 4:20 pm

I am using Oxygen XML Editor 17.0 (Saxon XQuery 9.6.0.5). Recently I have created a very basic XQuery code to perform some statistic measurements over the XML files on Web Dav server. Let's say I just want to count the number of .xml files in one directory. I added the XQuery file to the location where .xml files are. Here is the code:

Code: Select all

xquery version "3.0" encoding "utf-8";
let $docs := collection('./?select=*.xml')
return count($docs)


I receive an error message: "FODC0004: Collection catalog should not use a namespace"

The code works fine when run locally. I am also able to search over one particular file (on server) using absolute path, but I want to have a universal code.

I am guessing it is connected with some restrictions on Web Dav server, but I am a newbie in this area. Could you please advice?
Radu
Posts: 5095

Re: XQuery collection() function on Web Dav server

Thu Dec 17, 2015 3:11 pm

Hi,

Basically as Michael Kay explained you:

http://stackoverflow.com/questions/34310470/xquery-collection-function-on-web-dav-server

the Saxon processor can only use the collection function to iterate a folder's contents when running the query over a local set of resources.

In the Oxygen Preferences->XML / XSLT-FO-XQuery / XSLT / Saxon / Saxon-HE/PE/EE / Advanced you can set a custom collection URI resolver Java implementation.
Another possible workaround would be instead of using a plain WebDav server to install the Exist XML Database. Exist allows you to run xqueries on the server side.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
luxlunae
Posts: 26

Re: XQuery collection() function on Web Dav server

Sat Feb 06, 2016 6:28 am

What would such a declaration look like for a collection of files in the following folder? I'm getting the same error but the documentation doesn't really give any examples for those preferences.

This is the line of code throwing the error:

let $names := collection('file:///D:/BlueMountainTEI/periodicals/bmtnaau/issues/1908/03_01/bmtnaau_1908-03_01.tei.xml')//tei:relatedItem[@type='constituent']//tei:persName


Thanks
adrian
Posts: 2326

Re: XQuery collection() function on Web Dav server

Mon Feb 08, 2016 7:06 pm

Hi,

Any reason why you're using collection and not doc() in this particular case?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2326

Re: XQuery collection() function on Web Dav server

Tue Feb 09, 2016 1:36 pm

Well, to answer your question, if you want a collection with all the .xml files from a local folder you can use:

Code: Select all

collection('file:///D:/BlueMountainTEI/periodicals/bmtnaau/issues/1908/03_01/?select=*.xml;recurse=yes')

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
luxlunae
Posts: 26

Re: XQuery collection() function on Web Dav server

Wed Feb 10, 2016 12:45 am

Thanks! I will try that. I've been very frustrated trying to get collections to work in oxygen.

Return to “XQuery”

Who is online

Users browsing this forum: No registered users and 0 guests