Hi Gunter,
Hi Kendall,

With more recent versions of BaseX I use the db:open() and fetch:xml() functions in order to open databases and files.

We introduced those functions because the `doc` function’s omnipotence lead to some confusion :-)

The `fetch:xml` function always resolves relative to the current working directory, which in the context of RestXQ is the project root, where .basex file resides.
`doc()`  otoh  resolves relative to the base-uri of the static context, which usually is the currently run query.

I hope this change won’t introduce to much problems with your codebase.

Best from Konstanz

Michael

Am 04.09.2017 um 07:50 schrieb Kendall Shaw <kendall.shaw@workday.com>:

I don’t have an answer, but I was curious and so I tried setting the option RESTPATH to /tmp. I am using 8.6.5.
 
With that, run=some.xq and run=../tmp/some.xq both ran the same query. In some.xq I had doc(‘../tmp/some.xml’) and I get an error that
/opt/tomcat/webapps/basex/tmp/some.xml doesn’t exist. WEBPATH is /opt/tomcat/webapps/basex/.
 
So, it could be a difference in settings or default settings between the 2 versions, as opposed to being a bug.
 
Kendall
 
From: <basex-talk-bounces@mailman.uni-konstanz.de> on behalf of Günter Dunz-Wolff <guenter.dunzwolff@gmail.com>
Date: Sunday, September 3, 2017 at 4:09 AM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] New basex-version -> broken paths
 
Hi all, 
 
I updated my aged basex-version (8.5.3) to 8.6.6. With the new version, my defined file-references are broken, for example:
let $style := doc('../xq_diff/remove_elements_from_doc.xsl‘)
Even files in the same directory with the XQuery-file (corrigenda.xq) like: let $tokens := doc(„tokens.xml")
 
With 8.5.3 the REST-Requests with http://localhost:8984/rest?run=xqs/corrigenda.xq worked without problems.
 
With 8.6.6 and with the same request I’ll get the following error:
Stopped at ., 11/18:
[FODC0002] Resource '/Users/xq_diff/remove_elements_from_doc.xsl' does not exist
OR
Stopped at ., 79/26:
[FODC0002] Resource '/Users/xxx/kleist_tokens.xml' does not exist.
 
It does work in BaseXGUI but not with the http-server. 
 
Thanks for any help, Guenter
 
 
 


Am 04.09.2017 um 07:50 schrieb Kendall Shaw <kendall.shaw@workday.com>:

I don’t have an answer, but I was curious and so I tried setting the option RESTPATH to /tmp. I am using 8.6.5.
 
With that, run=some.xq and run=../tmp/some.xq both ran the same query. In some.xq I had doc(‘../tmp/some.xml’) and I get an error that
/opt/tomcat/webapps/basex/tmp/some.xml doesn’t exist. WEBPATH is /opt/tomcat/webapps/basex/.
 
So, it could be a difference in settings or default settings between the 2 versions, as opposed to being a bug.
 
Kendall
 
From: <basex-talk-bounces@mailman.uni-konstanz.de> on behalf of Günter Dunz-Wolff <guenter.dunzwolff@gmail.com>
Date: Sunday, September 3, 2017 at 4:09 AM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] New basex-version -> broken paths
 
Hi all, 
 
I updated my aged basex-version (8.5.3) to 8.6.6. With the new version, my defined file-references are broken, for example:
let $style := doc('../xq_diff/remove_elements_from_doc.xsl‘)
Even files in the same directory with the XQuery-file (corrigenda.xq) like: let $tokens := doc(„tokens.xml")
 
With 8.5.3 the REST-Requests with http://localhost:8984/rest?run=xqs/corrigenda.xq worked without problems.
 
With 8.6.6 and with the same request I’ll get the following error:
Stopped at ., 11/18:
[FODC0002] Resource '/Users/xq_diff/remove_elements_from_doc.xsl' does not exist
OR
Stopped at ., 79/26:
[FODC0002] Resource '/Users/xxx/kleist_tokens.xml' does not exist.
 
It does work in BaseXGUI but not with the http-server. 
 
Thanks for any help, Guenter