It looks much cleaner! thanks a lot! ------------------ 原始邮件 ------------------ 发件人: "Liam R. E. Quin"<liam@w3.org>; 发送时间: 2017年8月8日(星期二) 上午9:58 收件人: "donaldjohn"<donaldjohn@qq.com>; "basex-talk"<basex-talk@mailman.uni-konstanz.de>; 主题: Re: [basex-talk] How could I reuse sub queries? On Tue, 2017-08-08 at 09:24 +0800, donaldjohn wrote:
is there a way that I can cache the sub query result and reuse it somewhere else? I think it will run faster in that way.
You may find it runs at the same speed - BaseX may have noticed hte common query. But you can try using, let $statuslist := for $result in doc("50PatentDividedCreatingClause.xml")/results/result return db:open($result/dbName)/business:PatentDocumentAndRelated/@status return ( . . . do stuff with $statuslist . . . do more stuff with $statuslist )
Liam -- Liam Quin, W3C, http://www.w3.org/People/Quin/ Staff contact for Verifiable Claims WG, XQuery WG Web slave for http://www.fromoldbooks.org/