Hello,

supposed I have rules sets for different issues and operating on different facts. Now I want to write an interface for users who don't want to be bothered with details of the Drools API and who wish interface methods which returns results for concrete questions like:

ResultFact getAnswerForQuestionXY()

How can such a concrete query be implemented?
My first idea was to store the result fact with the help of globals:
rule "XY"
when
FactX ()
then
ResultFact resultFact = new ResultFact();
service.addResultFact(resultFact);
insert(resultFact
);
end

So my method would only return something like service.getResultFact().
I don't know if there are better solutions or if it is unusual to use methods for concrete queries.


Kind regards
Thomas