[rules-users] Fire rule only upon change of particular event (or fact)

Jörg Henne hennejg at gmail.com
Sun May 26 10:16:16 EDT 2013


It is nice to hear that my idea isn't totally off the scale and has even been
considered earlier. I'm curious what the other two cents will add up to.

Thanks for your pointer to queries as a solution for those cases. I hadn't
considered them, because I thought the query result was basically static. I
changed my code like this:

query someFact(SomeFact f)
    SomeFact(this == f)
end
rule "Trigger on some event when there is some fact"
    when
        e: SomeEvent()
        ?someFact(f;)
    then
        System.out.println("=> Got Event '" + e.getName() + "' and Fact '" +
f.getName() + "'");
end

It works, but I still have two questions:
- is this che correct way to 'retrieve' the query result?
- the result is the same, regardless of whether I use '?someFact(f;)' or
'someFact(f;)'. Shouldn't the latter be reactive and trigger the rule upon
the insertion of SomeFacts?



--
View this message in context: http://drools.46999.n3.nabble.com/Fire-rule-only-upon-change-of-particular-event-or-fact-tp4023972p4023974.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list