[英]Querying collections in eXist-db
I have XML files in eXist-db in the following collections: 我在以下集合中的eXist-db中有XML文件:
I want to run an XQuery in the /db/OCR collection across all the "banks" satisfying a condition and want to return the name of the bank which satisfied the condition. 我想在所有满足条件的“银行”中的/ db / OCR集合中运行XQuery,并想返回满足条件的银行的名称。 I wrote a query but am stuck in the return part of the FLWOR expression.
我写了一个查询,但被卡在FLWOR表达式的返回部分中。
declare default element namespace 'http://www.xbrl.org/2003/instance';
declare namespace ifrs = 'http://xbrl.ifrs.org/taxonomy/2013-03-28/ifrs';
for $x in collection("/db/OCR")
let $z := $x/xbrl/ifrs:Assets (: want to have query in assets of all files in the banks :)
return
if (exists($z) and xs:integer($z/text())>9999999)
then ???
Now how can I return the collection name like "Everest_Bank" for the results that satisfy my conditions? 现在,如何为满足我的条件的结果返回类似“ Everest_Bank”的集合名称? Please help.
请帮忙。
The generic and portable way to do this on XQuery engines is: 在XQuery引擎上执行此操作的通用方法是:
document-uri( root($z) )
will give you the URI of the document in eXist-db; 将为您提供eXist-db中文档的URI; the collection information is in the URI;
收集信息在URI中;
the eXist-db specific way (warning: not portable to other XQuery implementations) is: eXist-db的特定方式(警告:不可移植到其他XQuery实现中)是:
util:collection-name( $z )
in the http://exist-db.org/xquery/util
function namespace. 在
http://exist-db.org/xquery/util
函数名称空间中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.