[rules-users] Support for dynamic / ad-hoc queries in Drools
Wolfgang Laun
wolfgang.laun at gmail.com
Wed Jun 27 06:56:07 EDT 2012
You can do that with a few lines of code to compile and deploy a query.
You pass in the session, the builder and the query text:
dq = new DynamicQuery( StatefulKnowledgeSession kSession,
KnowledgeBuilder kBuilder,
String queryString )
and you call it, passing in the parameters you might have:
QueryResults results = dq.execute(...);
And you could add a remove() method.
-W
On 27/06/2012, jpullmann <jaroslav.pullmann at fit.fraunhofer.de> wrote:
> Hello,
> is there any support for ad-hoc queries in Drools or are there plans to
> introduce this feature ?
> Being part of the rule base queries are executed in the manner of
> prepared
> statements.
> To execute dynamic query patterns I currently create, add and remove a KB
> package containing
> the query. It would be great to have a dedicated/optimized utility method
> in Drools, that accepts
> a string pattern and returns QueryResults, like
> WorkingMemory#getQueryResults. There were similar
> requests earlier [1], [2], but they were not responded with regard to
> dynamic queries.
>
> [1] http://drools.46999.n3.nabble.com/Creating-ad-hoc-queries-td51522.html
> [2]
> http://drools.46999.n3.nabble.com/Inspecting-Working-Memory-td52382.html
>
> Best regards
> Jaro
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Support-for-dynamic-ad-hoc-queries-in-Drools-tp4018281.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
More information about the rules-users
mailing list