Aha aha... how could I miss that :) Thanks for answering!


Quoting Dirk Kirsten <d...@basex.org>:

Hi Guiseppe,

well, BaseX is smart and figures out that 6-2 is 4 ;) When you just use
the numbers, XQuery will assume it is an xs:integer, so accordingly it
will compute the result. If you want to use it as string you have to
enclose it in "", i.e.

    "/cluster/home/g/results2/" || "6-2" || ".xml"

although the concatenation in this case would not be necessary.

Cheers

Dirk


On 05/11/2017 10:11 AM, cel...@informatik.uni-leipzig.de wrote:

Hi All,

It is not clear to me why, when I tried to save the result of one
query in a file called 6-2.xml, BaseX automatically converted this
name into 4.xml. Similar name changes happened with files I wanted to
name 1-2.xml and 10-2.xml.

I attach part of the query info output (with highlights for the
relevant points)

Query:
declare variable $pp := doc("/cluster/home/g/files/all.xml")/d/t; for
$s at $c in collection("/cluster/home/g/files/splitted-db/")[6] return
file:write("/cluster/home/g/results2/" || 6-2 || ".xml", <sub-db>{ for
$e in $s//d let $db := $pp[$e/p = ./p and $e/f = ./f] return if ($db)
then element d {$e/@*, $e/*, for $u in $db/l return element e
{$u/text()}} else $e }</sub-db> )

Compiling:
- pre-evaluating doc("/cluster/home/g/files/all.xml")
- pre-evaluating collection("/cluster/home/g/files/splitted-db/")
- rewriting ((db:open-pre("splitted-db",0), ...))[position() = 6]
- type check removed: $c_2 as xs:integer
- pre-evaluating (6 - 2)
- pre-evaluating concat("/cluster/home/g/results2/", 4, ".xml")
- rewriting descendant-or-self step(s)
- swapping operands: (p = $e_3/*:p)
- swapping operands: (f = $e_3/*:f)
- rewriting ((p = $e_3/*:p) and (f = $e_3/*:f)) to predicate(s)
- pre-evaluating boolean((p = $e_3/*:p))
- pre-evaluating boolean((f = $e_3/*:f))
- rewriting singleton for to let
- inlining $s_1
- converting descendant::*:d to child steps
- inlining $c_2
- simplifying flwor expression

Best,
Giuseppe


--
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22



Reply via email to