首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从BaseX控制台执行XQuery?

如何从BaseX控制台执行XQuery?
EN

Stack Overflow用户
提问于 2019-01-02 23:45:39
回答 1查看 424关注 0票数 1

如何在standalone模式下从BaseX运行XQuery

使用BaseX进行简单的读取和查询:

代码语言:javascript
复制
thufir@dur:~/basex$ 
thufir@dur:~/basex$ basex
[warning] /usr/bin/basex: Unable to locate /usr/share/java/jing.jar in /usr/share/java
BaseX 9.0.1 [Standalone]
Try 'help' to get more information.
> 
> LIST
Name  Resources  Size  Input Path                        
-------------------------------------------------------
note  1          5208  /home/thufir/basex/note.data.xml  

1 database(s).
> 
> OPEN note
Database 'note' was opened in 65.07 ms.
> 
> XQUERY db:open("note")//note
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>
Query executed in 251.29 ms.
> 
> RUN query.note.db.xq
Resource "/home/thufir/query.note.db.xq" not found.
> 
> RUN query.note.xq
Resource "/home/thufir/query.note.xq" not found.
> 
> exit
Have a nice day.
thufir@dur:~/basex$ 

另存为XQuery文件的查询:

代码语言:javascript
复制
thufir@dur:~/basex$ 
thufir@dur:~/basex$ cat query.note.db.xq 

db:open("note")//note


thufir@dur:~/basex$ 
thufir@dur:~/basex$ cat query.note.xq 
//note
thufir@dur:~/basex$ 
thufir@dur:~/basex$ pwd
/home/thufir/basex
thufir@dur:~/basex$ 

从图形用户界面运行fine

EN

回答 1

Stack Overflow用户

发布于 2019-01-03 00:43:41

固定路径:

代码语言:javascript
复制
thufir@dur:~/basex$ 
thufir@dur:~/basex$ basex
[warning] /usr/bin/basex: Unable to locate /usr/share/java/jing.jar in /usr/share/java
BaseX 9.0.1 [Standalone]
Try 'help' to get more information.
> 
> RUN basex/query.note.db.xq
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>
Query "query.note.db.xq" executed in 472.97 ms.
> 
> exit
Enjoy life.
thufir@dur:~/basex$ 

(感谢Christian Gruen确认这是一个路径问题。)

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54009208

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档