8.5.3 and xquery:invoke ...
Wednesday, 31 August 2016 · 5 messages · last reply 11 Sep 2016
ML
Marco Lettere31 Aug 2016 18:52 #
Hello again,
at the end I managed to reproduce the issue we are currently facing with xquery:invoke in 8.5.3 (and also in latest snapshot).
Please consider the three queries [1,2,3]. The store [2] into a subdirectory src of the directory containing [1] and store [3] into a directory src2 of src.
You should get the error message [4].
If instead you change the parameter of xquery:invoke to
"src/src2/q2.xqm" it works.
Seems like the reference for static-base-uri in [2] remains the one of [1] even if it is reported by static-base-uri() to be correctly "/home/user/src/q1.xqm"(I've double-checked this).
Sorry it's not clear to me whether this is meant to be the correct behaviour ...
Thanks for any help,
Marco.
[1] q.xqm
import module namespace q1="urn:q1" at "src/q1.xqm";
q1:f()[2] q1.xqm
module namespace q1 = "urn:q1";
declare function q1:f(){
xquery:invoke("src2/q2.xqm")
};[3] q2.xqm
1 = 1
[4]
Stopped at /home/user/src/q1.xqm, 4/16:
[FODC0002] Resource 'src2/q2.xqm' does not exist.
LV
Lizzi, Vincent3 Sep 2016 02:10 #
I've run into what might be a variation of the same problem.
Inside an expath packaged module, a .xqm file uses relative file path references to .xsl files contained within the module. In my case, the relative file path references are being used with
xslt:transform(). The path resolution might be exhibiting the same problem that you encountered with xquery:invoke().
With BaseX 8.2.3, using a relative file path inside a module worked. With BaseX 8.5.3 the same module gives an error "Resource ... does not exist."
By adding file:base-dir() to resolve the path helps, and seems to work in both versions 8.2.3 and 8.5.3.
Marco, if you change:xquery:invoke("src2/q2.xqm")to this:
xquery:invoke(file:base-dir() || "src2/q2.xqm")Does this solve the "Resource ... does not exist." problem for you?
Vincent
Quoted text · Marco Lettere · 27 lines
-----Original Message----- From: basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] On Behalf Of Marco Lettere Sent: Wednesday, August 31, 2016 12:53 PM To: BaseX <basex-talk at mailman.uni-konstanz.de> Subject: [basex-talk] 8.5.3 and xquery:invoke ... Hello again, at the end I managed to reproduce the issue we are currently facing with xquery:invoke in 8.5.3 (and also in latest snapshot). Please consider the three queries [1,2,3]. The store [2] into a subdirectory src of the directory containing [1] and store [3] into a directory src2 of src. You should get the error message [4]. If instead you change the parameter of xquery:invoke to "src/src2/q2.xqm" it works. Seems like the reference for static-base-uri in [2] remains the one of [1] even if it is reported by static-base-uri() to be correctly "/home/user/src/q1.xqm"(I've double-checked this). Sorry it's not clear to me whether this is meant to be the correct behaviour ... Thanks for any help, Marco. [1] q.xqm import module namespace q1="urn:q1" at "src/q1.xqm"; q1:f() [2] q1.xqm module namespace q1 = "urn:q1"; declare function q1:f(){ xquery:invoke("src2/q2.xqm") }; [3] q2.xqm 1 = 1 [4] Stopped at /home/user/src/q1.xqm, 4/16: [FODC0002] Resource 'src2/q2.xqm' does not exist.
ML
Marco Lettere3 Sep 2016 11:18 #
Oh, right. Interesting to see that I've stumbled upon the same issue in just two weeks! :-D
Will give a try to file:base-uri().
Will this be the standard solution in the future?
Thanks again,
Marco.
Quoted text · Vincent · 59 lines
On 03/09/2016 02:10, Lizzi, Vincent wrote: > I've run into what might be a variation of the same problem. > > Inside an expath packaged module, a .xqm file uses relative file path references to .xsl files contained within the module. In my case, the relative file path references are being used with xslt:transform(). The path resolution might be exhibiting the same problem that you encountered with xquery:invoke(). > > With BaseX 8.2.3, using a relative file path inside a module worked. With BaseX 8.5.3 the same module gives an error "Resource ... does not exist." > > By adding file:base-dir() to resolve the path helps, and seems to work in both versions 8.2.3 and 8.5.3. > > Marco, if you change: > > xquery:invoke("src2/q2.xqm") > > to this: > > xquery:invoke(file:base-dir() || "src2/q2.xqm") > > Does this solve the "Resource ... does not exist." problem for you? > > Vincent > > > > -----Original Message----- > From: basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] On Behalf Of Marco Lettere > Sent: Wednesday, August 31, 2016 12:53 PM > To: BaseX <basex-talk at mailman.uni-konstanz.de> > Subject: [basex-talk] 8.5.3 and xquery:invoke ... > > Hello again, > at the end I managed to reproduce the issue we are currently facing with xquery:invoke in 8.5.3 (and also in latest snapshot). > > Please consider the three queries [1,2,3]. The store [2] into a subdirectory src of the directory containing [1] and store [3] into a directory src2 of src. > You should get the error message [4]. > If instead you change the parameter of xquery:invoke to "src/src2/q2.xqm" it works. > Seems like the reference for static-base-uri in [2] remains the one of [1] even if it is reported by static-base-uri() to be correctly "/home/user/src/q1.xqm"(I've double-checked this). > Sorry it's not clear to me whether this is meant to be the correct behaviour ... > Thanks for any help, > Marco. > > [1] q.xqm > import module namespace q1="urn:q1" at "src/q1.xqm"; > > q1:f() > > [2] q1.xqm > module namespace q1 = "urn:q1"; > > declare function q1:f(){ > xquery:invoke("src2/q2.xqm") > }; > > [3] q2.xqm > 1 = 1 > > [4] > Stopped at /home/user/src/q1.xqm, 4/16: > [FODC0002] Resource 'src2/q2.xqm' does not exist. >
CG
Christian Grün11 Sep 2016 10:55 #
Hi Marco, thanks Vincent,
At first glance, I am surprised that file:base-uri() is required here, basically because I would expect both variants to resolve to the same directory. I will check it in more detail soon.
Quoted text · Marco Lettere · 85 lines
On Sat, Sep 3, 2016 at 11:18 AM, Marco Lettere <m.lettere at gmail.com> wrote: > Oh, right. Interesting to see that I've stumbled upon the same issue in just > two weeks! :-D > Will give a try to file:base-uri(). > Will this be the standard solution in the future? > Thanks again, > Marco. > > > On 03/09/2016 02:10, Lizzi, Vincent wrote: >> >> I've run into what might be a variation of the same problem. >> >> Inside an expath packaged module, a .xqm file uses relative file path >> references to .xsl files contained within the module. In my case, the >> relative file path references are being used with xslt:transform(). The path >> resolution might be exhibiting the same problem that you encountered with >> xquery:invoke(). >> >> With BaseX 8.2.3, using a relative file path inside a module worked. With >> BaseX 8.5.3 the same module gives an error "Resource ... does not exist." >> >> By adding file:base-dir() to resolve the path helps, and seems to work in >> both versions 8.2.3 and 8.5.3. >> >> Marco, if you change: >> >> xquery:invoke("src2/q2.xqm") >> >> to this: >> >> xquery:invoke(file:base-dir() || "src2/q2.xqm") >> >> Does this solve the "Resource ... does not exist." problem for you? >> >> Vincent >> >> >> >> -----Original Message----- >> From: basex-talk-bounces at mailman.uni-konstanz.de >> [mailto:basex-talk-bounces at mailman.uni-konstanz.de] On Behalf Of Marco >> Lettere >> Sent: Wednesday, August 31, 2016 12:53 PM >> To: BaseX <basex-talk at mailman.uni-konstanz.de> >> Subject: [basex-talk] 8.5.3 and xquery:invoke ... >> >> Hello again, >> at the end I managed to reproduce the issue we are currently facing with >> xquery:invoke in 8.5.3 (and also in latest snapshot). >> >> Please consider the three queries [1,2,3]. The store [2] into a >> subdirectory src of the directory containing [1] and store [3] into a >> directory src2 of src. >> You should get the error message [4]. >> If instead you change the parameter of xquery:invoke to "src/src2/q2.xqm" >> it works. >> Seems like the reference for static-base-uri in [2] remains the one of [1] >> even if it is reported by static-base-uri() to be correctly >> "/home/user/src/q1.xqm"(I've double-checked this). >> Sorry it's not clear to me whether this is meant to be the correct >> behaviour ... >> Thanks for any help, >> Marco. >> >> [1] q.xqm >> import module namespace q1="urn:q1" at "src/q1.xqm"; >> >> q1:f() >> >> [2] q1.xqm >> module namespace q1 = "urn:q1"; >> >> declare function q1:f(){ >> xquery:invoke("src2/q2.xqm") >> }; >> >> [3] q2.xqm >> 1 = 1 >> >> [4] >> Stopped at /home/user/src/q1.xqm, 4/16: >> [FODC0002] Resource 'src2/q2.xqm' does not exist. >> >
CG
Christian Grün11 Sep 2016 18:15 #
My surprise ended up with the finding that I introduced an error while gradually preparing our code for (the long path to) query
precompilation. Thanks! It has been fixed [1].
Cheers
Christian (just the name, btw, not the confession ;)
[1] http://files.basex.org/releases/latest/
Quoted text · Christian Grün · 95 lines
On Sun, Sep 11, 2016 at 10:55 AM, Christian Grün <christian.gruen at gmail.com> wrote: > Hi Marco, thanks Vincent, > > At first glance, I am surprised that file:base-uri() is required here, > basically because I would expect both variants to resolve to the same > directory. I will check it in more detail soon. > > > > On Sat, Sep 3, 2016 at 11:18 AM, Marco Lettere <m.lettere at gmail.com> wrote: >> Oh, right. Interesting to see that I've stumbled upon the same issue in just >> two weeks! :-D >> Will give a try to file:base-uri(). >> Will this be the standard solution in the future? >> Thanks again, >> Marco. >> >> >> On 03/09/2016 02:10, Lizzi, Vincent wrote: >>> >>> I've run into what might be a variation of the same problem. >>> >>> Inside an expath packaged module, a .xqm file uses relative file path >>> references to .xsl files contained within the module. In my case, the >>> relative file path references are being used with xslt:transform(). The path >>> resolution might be exhibiting the same problem that you encountered with >>> xquery:invoke(). >>> >>> With BaseX 8.2.3, using a relative file path inside a module worked. With >>> BaseX 8.5.3 the same module gives an error "Resource ... does not exist." >>> >>> By adding file:base-dir() to resolve the path helps, and seems to work in >>> both versions 8.2.3 and 8.5.3. >>> >>> Marco, if you change: >>> >>> xquery:invoke("src2/q2.xqm") >>> >>> to this: >>> >>> xquery:invoke(file:base-dir() || "src2/q2.xqm") >>> >>> Does this solve the "Resource ... does not exist." problem for you? >>> >>> Vincent >>> >>> >>> >>> -----Original Message----- >>> From: basex-talk-bounces at mailman.uni-konstanz.de >>> [mailto:basex-talk-bounces at mailman.uni-konstanz.de] On Behalf Of Marco >>> Lettere >>> Sent: Wednesday, August 31, 2016 12:53 PM >>> To: BaseX <basex-talk at mailman.uni-konstanz.de> >>> Subject: [basex-talk] 8.5.3 and xquery:invoke ... >>> >>> Hello again, >>> at the end I managed to reproduce the issue we are currently facing with >>> xquery:invoke in 8.5.3 (and also in latest snapshot). >>> >>> Please consider the three queries [1,2,3]. The store [2] into a >>> subdirectory src of the directory containing [1] and store [3] into a >>> directory src2 of src. >>> You should get the error message [4]. >>> If instead you change the parameter of xquery:invoke to "src/src2/q2.xqm" >>> it works. >>> Seems like the reference for static-base-uri in [2] remains the one of [1] >>> even if it is reported by static-base-uri() to be correctly >>> "/home/user/src/q1.xqm"(I've double-checked this). >>> Sorry it's not clear to me whether this is meant to be the correct >>> behaviour ... >>> Thanks for any help, >>> Marco. >>> >>> [1] q.xqm >>> import module namespace q1="urn:q1" at "src/q1.xqm"; >>> >>> q1:f() >>> >>> [2] q1.xqm >>> module namespace q1 = "urn:q1"; >>> >>> declare function q1:f(){ >>> xquery:invoke("src2/q2.xqm") >>> }; >>> >>> [3] q2.xqm >>> 1 = 1 >>> >>> [4] >>> Stopped at /home/user/src/q1.xqm, 4/16: >>> [FODC0002] Resource 'src2/q2.xqm' does not exist. >>> >>
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery