简体   繁体   English

对Drools的查询以哪种顺序返回结果?

[英]In which order a query on Drools return the results?

I defined a query in a drools drl file that returns a set (series) of objects as its result. 我在drools drl文件中定义了一个查询,该查询返回一组(系列)对象作为结果。

query "q0"
e: Facts()
end

My question is, in what order does the query return these objects? 我的问题是,查询以什么顺序返回这些对象? Is it in the order of their insertion in the working memory or in an arbitrary fashion? 是按照它们插入工作存储器的顺序还是以任意方式?

The order of the firings of one rule or the order of facts returned with a query is undefined. 未触发一条规则的触发顺序或查询返回的事实顺序。 Whatever order you may observe now, with the Drools release you have installed, may change with the next release. 在安装了Drools版本之后,无论您现在观察到的顺序如何,在下一个版本中都可能会更改。

If you need a certain order, I suggest you use Collections.sort applied to the result set. 如果需要一定顺序,建议您将Collections.sort应用于结果集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM