New basex-version -> broken paths
Sunday, 3 September 2017 · 6 messages · last reply 4 Sep 2017
GD
Günter Dunz-Wolff3 Sep 2017 13:09 #
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 <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
KS
Kendall Shaw4 Sep 2017 07:50 #
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.
KendallQuoted text · Günter Dunz-Wolff · 17 lines
From: <basex-talk-bounces at mailman.uni-konstanz.de> on behalf of Günter Dunz-Wolff <guenter.dunzwolff at gmail.com> Date: Sunday, September 3, 2017 at 4:09 AM To: BaseX <basex-talk at 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<https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8984_rest-3Frun-3Dxqs_corrigenda.xq&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oOlfiKZawgkSitHZYJ_efZTO4FbrLxjI0NrGm2CgKio&s=2_gllMgHxtkfLyw0vLzpCaWr3leohjjigaO42goQlus&e=> 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
MS
Michael Seiferle4 Sep 2017 12:17 #
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
MichaelQuoted text · Kendall Shaw · 118 lines
> Am 04.09.2017 um 07:50 schrieb Kendall Shaw <kendall.shaw at 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 at mailman.uni-konstanz.de> on behalf of Günter Dunz-Wolff <guenter.dunzwolff at gmail.com> > Date: Sunday, September 3, 2017 at 4:09 AM > To: BaseX <basex-talk at 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 at 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 at mailman.uni-konstanz.de> on behalf of Günter Dunz-Wolff <guenter.dunzwolff at gmail.com> > Date: Sunday, September 3, 2017 at 4:09 AM > To: BaseX <basex-talk at 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 > > > > > >
GD
Günter Dunz-Wolff4 Sep 2017 14:32 #
Hi Michael,
thanks for the information.
I changed
let $tokens := doc("tokens.xml")//entry
to
let $tokens := fetch:xml("tokens.xml")//entry
(tokens.xml is in the same directory as the xq-file.)
The problem is still the same:
[bxerr:BXFE0001] Resource "/Users/User/tokens.xml (No such file or directory)" not found.
The path should be: /Users/User/Documents/project/BaseXWeb/tokens.xml
Same problems with
RESTPATH empty or path to project-folder.
As I wrote, I have only problems with the REST-Service, not with RESTXQ.
Best,
GuenterMS
Michael Seiferle4 Sep 2017 17:56 #
Hi Günter,
sorry for my blatant ignorance, I am using RESTXQ over REST so regularly, that I almost forgot about the actual REST-Servlet!
Still I encourage you to go with fetch:xml(); so if you changed it from:
Quoted text · Günter Dunz-Wolff · 1 line
> let $tokens := fetch:xml("tokens.xml")//entry
To:
Quoted text · Günter Dunz-Wolff · 1 line
> let $tokens := fetch:xml(„relative/to/.basex-home/tokens.xml")//entry
With
fetch:xml in contrast to doc() it should work consistently across all modes of operation (REST, RestXQ, BaseX Standalone).Quoted text · Günter Dunz-Wolff · 1 line
> See: http://docs.basex.org/wiki/Fetch_Module#Conventions <http://docs.basex.org/wiki/Fetch_Module#Conventions> And this GIST for resolving inconsistencies: https://gist.github.com/micheee/2baf385a1974c9da0db867ed2634cf48
I am not really sure when the behavior of
doc in the REST servlet changed, but a commit between 8.5.4 and 8.6 must have introduced this change.
RESTPATH is used to define the location of the XQuery files ran via the ?run=-Parameter, but it does not change the base uri of the static context.
Hope this won’t cause too much trouble with your codebase.
Best
Michael
Btw. You are not the first one to encounter the intricacies of the doc() function: https://github.com/BaseXdb/basex/issues/1435 <https://github.com/BaseXdb/basex/issues/1435>Quoted text · Günter Dunz-Wolff · 22 lines
> Am 04.09.2017 um 14:32 schrieb Günter Dunz-Wolff <guenter.dunzwolff at gmail.com>: > > Hi Michael, > > thanks for the information. > I changed > let $tokens := doc("tokens.xml")//entry > to > let $tokens := fetch:xml("tokens.xml")//entry > (tokens.xml is in the same directory as the xq-file.) > > The problem is still the same: > [bxerr:BXFE0001] Resource "/Users/User/tokens.xml (No such file or directory)" not found. > > The path should be: /Users/User/Documents/project/BaseXWeb/tokens.xml > > Same problems with RESTPATH empty or path to project-folder. > > As I wrote, I have only problems with the REST-Service, not with RESTXQ. > > Best, > Guenter
GD
Günter Dunz-Wolff4 Sep 2017 18:26 #
Hi Michael,
thanks for your support. Now it’s beginning to work :)
One more question:
Currently my USERHOME() is at /Users/User where .basex is located. My project has not the same path on my developer- and on my production-machine. "relative/to/.basex-home“ would be different in both scenarios. How to deal with that problem?
Thanks for your help!
Best, Guenter
Quoted text · Michael Seiferle · 51 lines
> Am 04.09.2017 um 17:56 schrieb Michael Seiferle <ms at basex.org>: > > Hi Günter, > > sorry for my blatant ignorance, I am using RESTXQ over REST so regularly, that I almost forgot about the actual REST-Servlet! > > > Still I encourage you to go with fetch:xml(); so if you changed it from: >> let $tokens := fetch:xml("tokens.xml")//entry > To: >> let $tokens := fetch:xml(„relative/to/.basex-home/tokens.xml")//entry > > With `fetch:xml` in contrast to `doc()` it should work consistently across all modes of operation (REST, RestXQ, BaseX Standalone). >> See: http://docs.basex.org/wiki/Fetch_Module#Conventions >> And this GIST for resolving inconsistencies: https://gist.github.com/micheee/2baf385a1974c9da0db867ed2634cf48 > > I am not really sure when the behavior of `doc` in the REST servlet changed, but a commit between 8.5.4 and 8.6 must have introduced this change. > > `RESTPATH` is used to define the location of the XQuery files ran via the `?run=`-Parameter, but it does not change the base uri of the static context. > > > Hope this won’t cause too much trouble with your codebase. > > Best > Michael > > Btw. You are not the first one to encounter the intricacies of the doc() function: https://github.com/BaseXdb/basex/issues/1435 > >> Am 04.09.2017 um 14:32 schrieb Günter Dunz-Wolff <guenter.dunzwolff at gmail.com>: >> >> Hi Michael, >> >> thanks for the information. >> I changed >> let $tokens := doc("tokens.xml")//entry >> to >> let $tokens := fetch:xml("tokens.xml")//entry >> (tokens.xml is in the same directory as the xq-file.) >> >> The problem is still the same: >> [bxerr:BXFE0001] Resource "/Users/User/tokens.xml (No such file or directory)" not found. >> >> The path should be: /Users/User/Documents/project/BaseXWeb/tokens.xml >> >> Same problems with RESTPATH empty or path to project-folder. >> >> As I wrote, I have only problems with the REST-Service, not with RESTXQ. >> >> Best, >> Guenter >
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery