Ok I thought I was getting every file in the database.
Because this works
let $collect := collection("C:\Users\Sayth\Documents\Racing\XML_examples") return $collect
Compiling: - pre-evaluating collection("C:\Users\Sayth\Documents\Racing\XML_examples") - inlining $collect_0 - simplifying flwor expression Optimized Query: (db:open-pre("XML_examples",0), ...) Query: let $collect := collection("C:\Users\Sayth\Documents\Racing\XML_examples") return $collect Result: - Hit(s): 6 Items - Updated: 0 Items - Printed: 874 KB - Read Locking: global - Write Locking: none Timing: - Parsing: 0.68 ms - Compiling: 465.14 ms - Evaluating: 12.21 ms - Printing: 48.23 ms - Total Time: 526.26 ms Query plan: <QueryPlan compiled="true"> <DBNodeSeq size="6"> <DBNode name="XML_examples" pre="0"/> <DBNode name="XML_examples" pre="4555"/> <DBNode name="XML_examples" pre="11206"/> <DBNode name="XML_examples" pre="18491"/> <DBNode name="XML_examples" pre="26345"/> </DBNodeSeq> </QueryPlan>
I think I need to use $node instead.
Sayth
On Fri, 19 Aug 2016 at 21:35 Christian Grün christian.gruen@gmail.com wrote:
Yes RaceXML1 not the concatenated RaceXML11.
If you only have a single database, then simply address it without loop: db:open('RaceXML1').
On Fri, 19 Aug 2016 at 21:31 Sayth Renshaw flebber.crue@gmail.com
wrote:
Oh it appears to not include part of my email as I psted from the
website.
I thought you were being odd.
for $i in 1 to 100 return db:open('books' || $i)//book/title
and I am using exactly the same but as
for $i in 1 to 100 return db:open("RaceXML1" || $i)//meeting/race
from here http://docs.basex.org/wiki/Databases
Sayth
On Fri, 19 Aug 2016 at 21:28 Sayth Renshaw flebber.crue@gmail.com
wrote:
Well following the example on the website is broken. I would like to
know
how to make it work and stop it concatenating the iterable to the
database
name and instead just iterate as expected.
Cheers
Sayth
On Fri, 19 Aug 2016 at 21:26 Christian Grün <christian.gruen@gmail.com
wrote:
Hi Sayth,
for $i in 1 to 100 return db:open('RaceXML1' || $i)//meeting/race What occurs though is that the iterable is concatenated to the database name and subsequently not found.
Error: Stopped at C:/Users/Sayth/Documents/firstquery.xq, 2/15: [bxerr:BXDB0002] Database 'RaceXML11' was not found.
To new to xquery to know why this is wrong.
I assume that you have no database called 'RaceXML11'. May I ask what’s the problem you want to see solved?
Christian
Full error is
Error: Stopped at C:/Users/Sayth/Documents/firstquery.xq, 2/15: [bxerr:BXDB0002] Database 'RaceXML11' was not found. Compiling:
- pre-evaluating (1 to 100)
- rewriting descendant-or-self step(s)
Optimized Query: for $i_0 in (1 to 100) return db:open(concat("RaceXML1", $i_0))/descendant::meeting/race Query: for $i in 1 to 100 return db:open("RaceXML1" || $i)//meeting/race Query plan:
<QueryPlan compiled="true"> <GFLWOR> <For> <Var name="$i" id="0"/> <RangeSeq from="1" to="100"/> </For> <CachedPath> <DbOpen name="open(database[,path])"> <FnConcat name="concat(atom1,atom2[,...])"> <Str value="RaceXML1" type="xs:string"/> <VarRef> <Var name="$i" id="0"/> </VarRef> </FnConcat> </DbOpen> <IterStep axis="descendant" test="meeting"/> <IterStep axis="child" test="race"/> </CachedPath> </GFLWOR> </QueryPlan>
Can you help?
Sayth