| Summary: | Sanitize docs | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | Mark Little <mark.little> |
| Component: | Documentation | Assignee: | Dana Mison <dmison> |
| Status: | CLOSED NEXTRELEASE | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | urgent | ||
| Version: | 5.0.0 GA | CC: | dlesage |
| Target Milestone: | --- | ||
| Target Release: | 5.0.1 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://jira.jboss.org/jira/browse/BRMS-134 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2009-10-02 14:14:32 UTC | Type: | Task |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 724273, 724274, 724275 | ||
|
Description
Mark Little
2009-06-01 11:02:01 UTC
That statement is present in the .org docs, but I couldn't find it in the official BRMS docs (user guide and reference guide). the BRMS is dead, long live the BRMS ? checking for content Just had a grep for the whole phrase, parts of it & some of the keywords from it. I don't recall ever seeing it so presumedly it was not in the docs that were used as the base for the BRMS Platform docs (drools-expert-docs & drools-guvnor-docs) Looks like it was added here 5 April 2009 labs/jbossrules/trunk/drools-docs/drools-docs-introduction/src/main/docbook/en-US/Chapter-Release_Notes/Section-What_is_new_Drools_5.xml http://lists.jboss.org/pipermail/jboss-svn-commits/2009-April/022382.html The original problem referred to in this JIRA has been resolved - however, I just found another one that we need to remove or change:
8.7. Honest Politician Example
8.7. Honest Politician Example
The honest politician example demonstrates truth maintenance with logical assertions. The basic
premise is that an object can only exist while a statement is true. A rule's consequence can logically
insert an object with the insertLogical method. This means the object will only remain in the working
memory as long as the rule that logically inserted it remains true, when the rule is no longer true the
object is automatically retracted.
In this example there is Politician class with a name and a boolean value for honest state, four
politicians with honest state set to true are inserted.
public class Politician
{
private String name;
private boolean honest;
//...
}
Example 8.53. Politician Class
Politician blair = new Politician("blair", true);
Politician bush = new Politician("bush", true);
Politician chirac = new Politician("chirac", true);
Politician schroder = new Politician("schroder", true);
ksession.insert( blair );
ksession.insert( bush );
ksession.insert( chirac );
ksession.insert( schroder );
ksession.fireAllRules();
Example 8.54. Honest Politician Execution
The console out shows that while there is at least one honest polician democracy lives. Democracy is
dead when all honest politicians are corrupted by an evil corporation, and become dishonest.
Hurrah!!! Democracy Lives
I'm an evil corporation and I have corrupted schroder
I'm an evil corporation and I have corrupted chirac
I'm an evil corporation and I have corrupted bush
I'm an evil corporation and I have corrupted blair
We are all Doomed!!! Democracy is Dead
Example 8.55. Console Output
As soon as there is one more more honest politcians in the working memory a new Hope object is
logically asserted, this object will only exist while there is at least one or more honest politicians, the
moment all politicians are dishonest then the Hope object will be automatically retracted. This rule is
given a salience of 10 to make sure it fires before any other rules, as at this stage the "Hope is Dead"
rule is actually true.
rule "We have an honest Politician"
salience 10
when
exists( Politician( honest == true ) )
then
insertLogical( new Hope() );
end
Example 8.56. Rule "We have an honest politician"
As soon as a Hope object exists, the "Hope Lives" rule matches, and fires. Because it has a salience
of 10, it takes priority over "Corrupt the Honest".
rule "Hope Lives"
salience 10
when
exists( Hope() )
then
System.out.println("Hurrah!!! Democracy Lives");
end
Example 8.57. Rule "Hope Lives"
Now that hope exists and we have, at the start, four honest politicians, we have 4 activations for this
rule all in conflict. This rule iterates over those rules firing each one in turn, corrupting each politician
so that they are no longer honest. When all four politicians have been corrupted we have no politicians
with the property "honest == true", therefore the rule "We have an honest Politician" is no longer true
and the object it logically inserts "new Hope()" is automatically retracted.
rule "Corrupt the Honest"
when
politician : Politician( honest == true )
exists( Hope() )
then
System.out.println( "I'm an evil corporation and I have corrupted "
+ politician.getName() );
modify ( politician ) { honest = false };
end
Example 8.58. Rule "Corrupt the Honest"
With Hope being automatically retracted, via the truth maintenance system, then Hope no longer
exists in the system and this rule will match and fire.
rule "Hope is Dead"
when
not( Hope() )
then
System.out.println( "We are all Doomed!!! Democracy is Dead" );
end
Example 8.59. Rule "Hope is Dead"
Lets take a look at the audit trail for this application:
Figure 8.17. Audit View
The moment we insert the first politician we have two activations. The "We have an honest Politician"
is activated only once for the first inserted politician because it uses an existential 'exists' conditional
element which only matches. The rule "Hope is Dead" is also activated at this stage, because we have
not inserted the Hope object yet.
"We have an honest Politician" fires first, because it has a higher salience over "Hope is Dead"
which inserts the Hope object (highlighted in green in the example). The insertion of the Hope object
activates "Hope Lives" and de-activates "Hope is Dead", it also actives "Corrupt the Honest" for each
inserted honest politician. "Rule Hope Lives" executes printing "Hurrah!!! Democracy Lives".
Then for each politician the rule "Corrupt the Honest" fires printing "I'm an evil corporation and I have
corrupted X", where X is the name of the politician, and modifies the politicians honest value to false.
When the last honest politician is corrupted Hope is automatically retracted, by the truth maintenance
system, as shown by the blue highlighted area.
The green highlighted area shows the origin of the currently selected blue highlighted area. Once
Hope is retracted "Hope is dead" activates and fires printing "We are all Doomed!!! Democracy is
Dead"
Is the problem here the choice of domain for the example ? I think Len is pointing out that the examples use real names and therefore might generate some comments from some supporter of the above. There is previous on this sort of thing, people complained about the original unix jokes in the tunefs and catman man pages. Link: Added: This issue is a dependency of BRMS-220 Link: Added: This issue is a dependency of BRMS-219 Link: Added: This issue is a dependency of BRMS-218 I think we can just remove this example. It is a little contrived and just demonstrates that objects inserted using insertLogical() are retracted if the rule that inserted them ceases to be matched for any reason. This is clearly stated in Section 4.8.3. The Right Hand Side (then). I have removed this section from the book. IMO it would be sufficient to rename these guys and keep the example. The more drools examples the better. Marking this as resolved - I think we found (and fixed) all the problems. Closing - all the edits mentioned previously in this JIRA are in the docs. |