I apologize, should have chosen my words better...
Drools does have 'logical assertion' in the sense that a fact will be inserted and automatically retracted when it's conditions are no longer true.
I meant it in the sense of in JESS/CLIPS you can assert an non-structured template to trigger another rule (as in this message board question where the issue was how to cause a rule to fire when another rule fires)
JESS/CLIPS Example:
(deftemplate fire-my-special-rule) //Notice no structure of the template, its just an object called 'fire-my-special-rule'
(defrule initial-rule
(blah...blah...patterns which make the first rule fire)
=>
(do some RHS actions)
(assert (fire-my-special-rule))
)
(defrule special-rule
(fire-my-special-rule) //here im just checking for the existance or truth of 'fire-my-special-rule'
=>
(RHS ACTIONS)
)
What i was getting at was, in JESS/CLIPS you can achieve what this question was asking by creating a deftemplate in the rule file that has no structure and use it to trigger another rule. In Drools you can not do this exactly, but if you created your own POJO 'flag' that stores a string and a boolean, then you could store to the string "fire-my-special-rule" and set the boolean to TRUE. In your Drool DRL rule, check to see if the flag pojo has it's string value as "fire-my-special-rule" and boolean "true".
Sorry, going on tangent, but yes i misspoke when i said Drools did not have Logical Assertions, it does. It just doesn't allow you to assert an unstructured template as does other rule engines do (which would have answered the original question in an easier / less hacked manner than my Flag POJO suggestion)
2010/8/22 Salaboy
<salaboy@gmail.com>
Drools have logicalInsert, what do you mean with: drools doesn't have this? It behaves differently than Jess and clips?
- Mauricio "Salaboy" Salatino -
Keep in mind that rules are declarative, it is against the nature of a rule based expert system to force a rule to fire; youre kind of treating the rule like a function.
My best advice is....
!
1)Create a POJO called "Flag", store a String and Boolean inside of it.
2)On the RHS of the first rule, create the POJO and set the string to something like "rule-03-fired" and set the boolean to 'true'
3)In the rule you want to fire, add a pattern to check for a Flag Fact Template with String value 'rule-03-fired' and 'true'
Note, this is normally done in CLIPS/JESS as logical assertions, but Drools does not have this. However, i'm sure it's implemented the same on the back end.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users