[rules-users] fact updates with query-only usage of Drools

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jun 14 05:50:10 EDT 2013


Can you provide a (complete) example where changing a fact object
without calling update produces a result of getQueryResults being
invoked after this change that contradicts the constraints of the
query's LHS?
-W

On 14/06/2013, Andras Nagy <andras.istvan.nagy at gmail.com> wrote:
> Hi Wolfgang,
>>How else would the engine know when to reevaluate LHSs?
> Well, the user manual is clear about the LHS of _rules_ being evaluated at
> assertion time, indeed. However I did not find information about this
> matter regarding _queries_. Sorry if I missed something, but the manual is
> mostly concerned about rules and I found less information about queries.
> (Btw. I'm not using live queries. )
> Actually, I have written a small test application following this
> principle (as described in my original mail, without the explicit update
> call) and it was working "correctly", i.e. if I updated a fact outside of
> the wm then I queried (by the attribute that was updated), the query
> already matched by the updated attribute.
> But I'd like to know whether this behaviour was somehow incidental or
> whether this is theoretically correct.
> Thank you for your help,
> regards,
> Andras
>
>
> On Fri, Jun 14, 2013 at 9:36 AM, Wolfgang Laun
> <wolfgang.laun at gmail.com>wrote:
>
>> On 14/06/2013, Andras Nagy <andras.istvan.nagy at gmail.com> wrote:
>> > Dear All,
>> > In a multithreaded application I plan to use Drools the following way:
>> > -use only queries but not rules
>> > -keep an outside reference to all facts inserted into the working
>> > memory,
>> > and keep modifying the facts after they were inserted
>> > -use locks synchronizing outside fact changes and Drools query
>> > executions
>> > (happening parallelly on other threads), to make sure that when the
>> queries
>> > are executed, the facts are always in a consistent state
>> > Given that the application only uses queries (and no rules), I wonder
>> > if
>> > there is a need to notify the engine of the fact changes (e.g.
>> > workingMemory.update(...) etc.).
>> > Could someone confirm that?
>>
>> How else would the engine know when to reevaluate LHSs?
>>
>> -W
>>
>> >
>> > Thank you,
>> > Andras
>> >
>> _______________________________________________
>> 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