All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.examples.HonestPolitician.drl Maven / Gradle / Ivy

The newest version!
package org.drools.examples
 
import org.drools.examples.HonestPoliticianExample.Politician;
import org.drools.examples.HonestPoliticianExample.Hope;
 
rule "We have an honest Politician"
    salience 10
    when
        exists( Politician( honest == true ) )
    then
        insertLogical( new Hope() );
end

rule "Hope Lives"
    salience 10
    when
        exists( Hope() )
    then
        System.out.println("Hurrah!!! Democracy Lives");
end

rule "Hope is Dead"
    when
        not( Hope() )
    then
        System.out.println( "We are all Doomed!!! Democracy is Dead" );
end

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 ) { 
            setHonest( false ) 
        }
end





© 2015 - 2025 Weber Informatics LLC | Privacy Policy