fn:trace() does not print

Friday, 8 June 2012 · 6 messages · last reply 9 Jun 2012
BD
Brock, David8 Jun 2012 19:14 #
Was using fn:trace() to print out warning statements during XQuery processing. Worked fine using SAXONICA XQuery, but does not print anything in BaseX. Is there a setting to get this to work, or is there some other call that I can make to do same? Thanks!
CG
Christian Grün8 Jun 2012 19:19 #
Quoted text · Brock, David · 4 lines
> Was using fn:trace() to print out warning statements during XQuery > processing. Worked fine using SAXONICA XQuery, but does not print anything > in BaseX. Is there a setting to get this to work, or is there some other > call that I can make to do same?
We are frequently using fn:trace(); the output is either sent to stderr or the InfoView of the GUI. It may be, however, that some of the traced data will be optimized in advance, and never be evaluated at runtime. How do your queries look like? Christian
BD
Brock, David8 Jun 2012 19:32 #
My query is of the form:
if (not(empty($variable))) then
	... return some XML...
else
	fn:trace((), "Warning : Variable is empty")
After your reply I tried the following to see if I remove the optimization, but not luck - still no output on stderr:
if (not(empty($variable))) then
	... return some XML...
else
	$result := fn:trace((), "Warning : Variable is empty")
	return $result
Quoted text · Christian Grün · 12 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: Friday, June 08, 2012 12:20 PM To: Brock, David Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] fn:trace() does not print > Was using fn:trace() to print out warning statements during XQuery > processing. Worked fine using SAXONICA XQuery, but does not print > anything in BaseX. Is there a setting to get this to work, or is > there some other call that I can make to do same? We are frequently using fn:trace(); the output is either sent to stderr or the InfoView of the GUI. It may be, however, that some of the traced data will be optimized in advance, and never be evaluated at runtime. How do your queries look like? Christian
CG
Christian Grün8 Jun 2012 20:24 #
It seems as if Saxon handles the empty sequence as a special case. The following query..
   trace( (1,2), "Trace: ")
..will create similar output in BaseX, Saxon, Zorba and other processors while Saxon is the only one (I tried) to return output for an empty sequence, such as...
  trace( (), "Trace: ")
The specification does not enforce a certain behavior on how to handle sequences [1], which is why different solution have been chosen. Hope this helps, Christian [1] http://www.w3.org/TR/xpath-functions-30/#func-trace
Quoted text · Brock, David · 14 lines
> My query is of the form: > > if (not(empty($variable))) then > ... return some XML... > else > fn:trace((), "Warning : Variable is empty") > > After your reply I tried the following to see if I remove the optimization, but not luck - still no output on stderr: > > if (not(empty($variable))) then > ... return some XML... > else > $result := fn:trace((), "Warning : Variable is empty") > return $result
BD
Brock, David9 Jun 2012 00:04 #
Thanks a bunch Christian, that did the trick! BTW is there a way to search the archives? I could not find a way on the website.
Quoted text · Christian Grün · 28 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: Friday, June 08, 2012 1:25 PM To: Brock, David Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] fn:trace() does not print It seems as if Saxon handles the empty sequence as a special case. The following query.. trace( (1,2), "Trace: ") ..will create similar output in BaseX, Saxon, Zorba and other processors while Saxon is the only one (I tried) to return output for an empty sequence, such as... trace( (), "Trace: ") The specification does not enforce a certain behavior on how to handle sequences [1], which is why different solution have been chosen. Hope this helps, Christian [1] http://www.w3.org/TR/xpath-functions-30/#func-trace > My query is of the form: > > if (not(empty($variable))) then > ... return some XML... > else > fn:trace((), "Warning : Variable is empty") > > After your reply I tried the following to see if I remove the optimization, but not luck - still no output on stderr: > > if (not(empty($variable))) then > ... return some XML... > else > $result := fn:trace((), "Warning : Variable is empty") > return $result
CG
Christian Grün9 Jun 2012 00:16 #
Quoted text · Brock, David · 1 line
> BTW is there a way to search the archives? I could not find a way on the website.
Here you are: http://basex.org/service/mailinglist-search/ http://www.mail-archive.com/basex-talk at mailman.uni-konstanz.de/msg00924.html
Quoted text · David · 41 lines
On Sat, Jun 9, 2012 at 12:04 AM, Brock, David <david_brock at mentor.com> wrote: > Thanks a bunch Christian, that did the trick! > > > -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: Friday, June 08, 2012 1:25 PM > To: Brock, David > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] fn:trace() does not print > > It seems as if Saxon handles the empty sequence as a special case. The following query.. > > trace( (1,2), "Trace: ") > > ..will create similar output in BaseX, Saxon, Zorba and other processors while Saxon is the only one (I tried) to return output for an empty sequence, such as... > > trace( (), "Trace: ") > > The specification does not enforce a certain behavior on how to handle sequences [1], which is why different solution have been chosen. > > Hope this helps, > Christian > > [1] http://www.w3.org/TR/xpath-functions-30/#func-trace > _______________________________ > >> My query is of the form: >> >> if (not(empty($variable))) then >> ... return some XML... >> else >> fn:trace((), "Warning : Variable is empty") >> >> After your reply I tried the following to see if I remove the optimization, but not luck - still no output on stderr: >> >> if (not(empty($variable))) then >> ... return some XML... >> else >> $result := fn:trace((), "Warning : Variable is empty") >> return $result

⚡Generated with XQuery