user3050423
user3050423

Reputation: 35

Query Results in Rule

I've made query in JBoss:

query "Cars" 
    c : Car()
end;

and I want to use in this rule:

rule "Ca"
    salience -100
    when
        c : Cars()
    then

end;

but anything what I'm doing occurs errors. Are there any possibilities to get query results in rule? I know about this method:

org.drools.runtime.rule.QueryResults results = ksession.getQueryResults( "Cars" );

but I need to get results in rule. Can anybody help?

Upvotes: 1

Views: 72

Answers (1)

salaboy
salaboy

Reputation: 4133

Why do you want to do that? you can do an accumulate to get the list of all your cars something like this: when $cars: List() from accumulate(Car()) then

You don't need a query for that.

Upvotes: 1

Related Questions