【发布时间】:2019-01-02 15:45:39
【问题描述】:
如何在standalone 模式下从BaseX 运行XQuery?
使用BaseX进行简单的读取和查询:
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 文件:
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$
从 GUI 工作 fine:
【问题讨论】:
标签: xml xpath command-line-interface xquery basex