how to specify a database in a.xq FLOWR query?

Monday, 7 October 2019 · 5 messages
T
thufir7 Oct 2019 10:53 #
how do I specify a database for a .xq file to use? a simple FLOWR: thufir@dur:~/basex/w3$ thufir@dur:~/basex/w3$ basex titles.xq [warning] /usr/bin/basex: Unable to locate /usr/share/java/jing.jar in /usr/share/java <title lang="en">Learning XML</title> <title lang="en">XQuery Kick Start</title>thufir@dur:~/basex/w3$ thufir@dur:~/basex/w3$ thufir@dur:~/basex/w3$ cat titles.xq for $x in doc("books.xml")/bookstore/book where $x/price>30 order by $x/title return $x/title thufir@dur:~/basex/w3$ (from w3schools) thanks, Thufir
CG
Christian Grünin reply to thufir, 7 Oct 2019, 14:397 Oct 2019 12:43 #
Quoted text · thufir · 2 lines
> Not to just return a > result but write that result back to basex.
Sure! See here [1] (more specifically, [2]).
Quoted text · thufir · 1 line
> thanks,
Quoted text · thufir · 24 lines
> On 2019-10-06 11:53 p.m., thufir wrote: > > how do I specify a database for a .xq file to use? > > > > a simple FLOWR: > > > > thufir@dur:~/basex/w3$ > > thufir@dur:~/basex/w3$ basex titles.xq > > [warning] /usr/bin/basex: Unable to locate /usr/share/java/jing.jar in > > /usr/share/java > > <title lang="en">Learning XML</title> > > <title lang="en">XQuery Kick Start</title>thufir@dur:~/basex/w3$ > > thufir@dur:~/basex/w3$ > > thufir@dur:~/basex/w3$ cat titles.xq > > for $x in doc("books.xml")/bookstore/book > > where $x/price>30 > > order by $x/title > > return $x/title > > thufir@dur:~/basex/w3$ > > > > (from w3schools) > > > > thanks, > > > > Thufir
T
thufirin reply to thufir, 7 Oct 2019, 10:537 Oct 2019 14:39 #
From SO (and the fine manual), the solution is to use: basex -i w3school_data titles.xq Very interesting. I'm sure this can be piped or simply written to a file, but is there a particularly "basex" method? Not to just return a result but write that result back to basex. thanks, Thufir
Quoted text · thufir · 24 lines
On 2019-10-06 11:53 p.m., thufir wrote: > how do I specify a database for a .xq file to use? > > a simple FLOWR: > > thufir@dur:~/basex/w3$ > thufir@dur:~/basex/w3$ basex titles.xq > [warning] /usr/bin/basex: Unable to locate /usr/share/java/jing.jar in > /usr/share/java > <title lang="en">Learning XML</title> > <title lang="en">XQuery Kick Start</title>thufir@dur:~/basex/w3$ > thufir@dur:~/basex/w3$ > thufir@dur:~/basex/w3$ cat titles.xq > for $x in doc("books.xml")/bookstore/book > where $x/price>30 > order by $x/title > return $x/title > thufir@dur:~/basex/w3$ > > (from w3schools) > > thanks, > > Thufir
CG
Christian Grünin reply to Liam R. E. Quin, 7 Oct 2019, 19:397 Oct 2019 17:55 #
Quoted text · Liam R. E. Quin · 1 line
> They were never affiliated with W3C, […]
Thanks for the info, Liam! I have added a little comment. Links to helpful resources are always welcome.
Quoted text · Liam R. E. Quin · 20 lines
On Mon, Oct 7, 2019 at 5:39 PM Liam R. E. Quin <liam at fromoldbooks.org> wrote: > > On Mon, 2019-10-07 at 03:38 -0700, thufir wrote: > > From SO (and the fine manual), the solution is to use: basex -i > > w3school_data titles.xq > > Seeing the filename propts me to note - w3schools (when i've looked at > it) isn't a good place to learn from. They were never affiliated with > W3C, and their tutorials often seem written by people without a deep > understanding. > > Mind you, i don't know many free online resources that are better > alternatives... > > -- > Liam Quin, https://www.delightfulcomputing.com/ > Available for XML/Document/Information Architecture/XSLT/ > XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. > Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org >
LQ
Liam R. E. Quinin reply to thufir, 7 Oct 2019, 14:397 Oct 2019 19:39 #
Quoted text · thufir · 3 lines
On Mon, 2019-10-07 at 03:38 -0700, thufir wrote: > From SO (and the fine manual), the solution is to use: basex -i > w3school_data titles.xq
Seeing the filename propts me to note - w3schools (when i've looked at it) isn't a good place to learn from. They were never affiliated with W3C, and their tutorials often seem written by people without a deep understanding. Mind you, i don't know many free online resources that are better alternatives...
-- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org

⚡Generated with XQuery