how to specify a BaseX database from a FLOWR xquery?

删除回忆录丶 提交于 2019-12-04 19:01:09

For the basex command line script you seem to use there is the -i option you can use to set a named database as the context or to use an input file for that so basex -i mydb xquery.xq runs your xquery.xq with the database called mydb as the context of the query.

From Martin's answer, this is the concrete xquery and command:

thufir@dur:~/basex/microsoft$ 
thufir@dur:~/basex/microsoft$ basex -i w3school_data titles.xq
<title>Creepy Crawlies</title>
<title>Lover Birds</title>
<title>MSXML3: A Comprehensive Guide</title>
<title>Maeve Ascendant</title>
<title>Microsoft .NET: The Programming Bible</title>
<title>Midnight Rain</title>
<title>Oberon's Legacy</title>
<title>Paradox Lost</title>
<title>Splish Splash</title>
<title>The Sundered Grail</title>
<title>Visual Studio 7: A Comprehensive Guide</title>
<title>XML Developer's Guide</title>thufir@dur:~/basex/microsoft$ 
thufir@dur:~/basex/microsoft$ 
thufir@dur:~/basex/microsoft$ cat titles.xq 
for $x in /catalog/book
order by $x/title
return $x/title 
thufir@dur:~/basex/microsoft$ 

I took a stab at the xquery and it worked! thanks Martin.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!