Xquery 创建集合,使用命令行将文档添加到zorba?

Xquery 创建集合,使用命令行将文档添加到zorba?,xquery,zorba,Xquery,Zorba,我想知道如何使用命令行界面在新的zorba安装中创建一个集合并向该集合添加一个文档 如果不能用命令行来完成,那么使用脚本api的例子就很好了 这可以使用XQuery脚本完成。考虑下面的XQuery模块: module namespace news-data = "http://www.news.org/data"; declare namespace an = "http://www.zorba-xquery.com/annotations"; declare collection news

我想知道如何使用命令行界面在新的zorba安装中创建一个集合并向该集合添加一个文档


如果不能用命令行来完成,那么使用脚本api的例子就很好了

这可以使用XQuery脚本完成。考虑下面的XQuery模块:

module namespace news-data = "http://www.news.org/data";

declare namespace an = "http://www.zorba-xquery.com/annotations";

declare collection news-data:employees as element(employee)*;
declare variable $news-data:employees := xs:QName('news-data:employees');
您可以这样使用它:

import module namespace news-data = "http://www.news.org/data" at "news-data.xq";

import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";

ddl:create($news-data:employees);
dml:insert-nodes($news-data:employees, doc("test2.xml"));