在具有 Tijah 扩展的 XQuery 中连接元素和分数列表,无需使用递归函数
对于大学搜索引擎项目,我使用带有 Tijah 扩展的 MonetDB。我有一个从搜索字符串返回的节点列表:
let $qid := tijah:queryall-id($nexi)
let $nodes := tijah:nodes($qid)
$nodes
现在包含一个元素列表,例如:
<book>Design Patterns</book>
<book>AntiPatterns</book>
我可以使用以下 FLWOR 表达式计算并返回该列表的分数:
for $book in $nodes
let $score := tijah:score($qid, $book)
order by $score descending
return <book score="{$score}">{$book/title}</book>
但是,我想在新的搜索查询中使用节点列表。为此,我必须从此列表中生成具有以下格式的字符串:
Design Patterns {0.2937} Antipatterns {0.43984}
在此格式中,分数(由 tijah:score
返回)和名称组合在一起。我想使用以下格式生成此字符串:递归函数,但我需要使用的 MonetDB 代数引擎不支持递归函数,
我可以使用非递归(可能是 FLWOR)表达式生成相同的结果吗?
For a university search engine project, I am using MonetDB with Tijah extensions. I've got a list of nodes, returned from a search string:
let $qid := tijah:queryall-id($nexi)
let $nodes := tijah:nodes($qid)
$nodes
now contains a list of elements, e.g.:
<book>Design Patterns</book>
<book>AntiPatterns</book>
I can calculate and return the scores for this list with the following FLWOR expression:
for $book in $nodes
let $score := tijah:score($qid, $book)
order by $score descending
return <book score="{$score}">{$book/title}</book>
However, I want to use the list of nodes in a new search query. To do this, I have to generate a string from this list with the following formatting:
Design Patterns {0.2937} Antipatterns {0.43984}
In this formatting the scores (returned by tijah:score
and the names are combined. I wanted to generate this string with a recursive function, but the MonetDB Algebra engine I need to use doesn't support recursive functions.
Can I generate the same result with a non-recursive (possibly FLWOR) expression?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是你想要的吗?
Does this do what you want?