Example concatenates iterable to database name
Friday, 19 August 2016 · 8 messages
SR
Sayth Renshaw19 Aug 2016 13:23 #
Hi
Running 8.5.3 on windows.
Currently open database is RaceXML1.
I am running the example from here http://docs.basex.org/wiki/Databases
for $i in 1 to 100
return db:open('books' || $i)//book/titleas
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.
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
CG
Christian Grün19 Aug 2016 13:26 #
Hi Sayth,
Quoted text · Sayth Renshaw · 9 lines
> 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
Quoted text · Sayth Renshaw · 39 lines
> > 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
SR
Sayth Renshaw19 Aug 2016 13:28 #
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
Quoted text · Christian Grün · 63 lines
On Fri, 19 Aug 2016 at 21:26 Christian Grün <christian.gruen at 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 >
CG
Christian Grün19 Aug 2016 13:30 #
Quoted text · Sayth Renshaw · 1 line
> Well following the example on the website is broken.
Well as well, it isn’t broken – you obviously need databases on your system that can be opened.
Quoted text · Sayth Renshaw · 3 lines
> 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.
Do you have any databases on your system that you can iterate through?
Christian
Quoted text · Christian Grün · 63 lines
> On Fri, 19 Aug 2016 at 21:26 Christian Grün <christian.gruen at 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
SR
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/titleand I am using exactly the same but as
for $i in 1 to 100
return db:open("RaceXML1" || $i)//meeting/racefrom here
http://docs.basex.org/wiki/Databases
Sayth
Quoted text · Sayth Renshaw · 74 lines
On Fri, 19 Aug 2016 at 21:28 Sayth Renshaw <flebber.crue at 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 at 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 >> >
SR
Sayth Renshaw19 Aug 2016 13:31 #
Yes RaceXML1 not the concatenated RaceXML11.
Sayth
Quoted text · Sayth Renshaw · 92 lines
On Fri, 19 Aug 2016 at 21:31 Sayth Renshaw <flebber.crue at 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 at 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 at 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 >>> >>
CG
Christian Grün19 Aug 2016 13:35 #
Quoted text · Sayth Renshaw · 1 line
> Yes RaceXML1 not the concatenated RaceXML11.
If you only have a single database, then simply address it without loop: db:open('RaceXML1').
Quoted text · Sayth Renshaw · 91 lines
> On Fri, 19 Aug 2016 at 21:31 Sayth Renshaw <flebber.crue at 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 at 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 at 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
SR
Sayth Renshaw19 Aug 2016 13:39 #
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 $collectCompiling:
- 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
Quoted text · Christian Grün · 106 lines
On Fri, 19 Aug 2016 at 21:35 Christian Grün <christian.gruen at 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 at 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 at 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 at 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 >
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery