[rules-users] PMML - Exception excuting consequence for rule xxx in yyy: java.lang.NullPointerException : using KnowledgeAgent

smilk sunghee.bae at meritz.co.kr
Wed Jul 17 20:39:02 EDT 2013


rule "OverrideInput_COV_CD_RE"
salience 2
when
    $new: java.lang.String() from entry-point "in_COV_CD_RE"
    $old: COV_CD_RE( value != $new )
then
    System.out.println(" Overriding previous values " + $old + " because of
" + $new );
    retract( $old );
end


 // Display Name : null
 
 declare CHK_YN extends  DataField 
  @role(event)
  @Traitable

    value : java.lang.String @key @position(1) 
    displayValue : String =  "CHK_YN" 

    weight : double     = 1.0

    
 end


rule "Valid_Values_CHK_YN"

no-loop
salience 9999
when
    $in : CHK_YN( $val : value, valid == false,
          
           value == "N"  ||  value == "Y" 
          )
then
    System.out.println("--- Invalid -> valid " + $in);
    modify ( $in ) {
        setValid( true );
    }
end


rule "Input_CHK_YN"
when
    $in : java.lang.String() from entry-point "in_CHK_YN"
    not CHK_YN( value == $in, context == null )
then
    // java.lang.String
    CHK_YN input = new CHK_YN();
        input.setValue( $in );
        input.setName("CHK_YN");
        input.setMissing(false);
        input.setValid(false);
        input.setContext(null);
    System.out.println("Rule " + drools.getRule().getName() + " for input "
+ $in + " : will insert  " + input.toString());
    retract( $in );
    insert( input );
end


rule "OverrideInput_CHK_YN"
salience 2
when
    $new: java.lang.String() from entry-point "in_CHK_YN"
    $old: CHK_YN( value != $new )
then
    System.out.println(" Overriding previous values " + $old + " because of
" + $new );
    retract( $old );
end


declare TreeToken
    context     : String
    current     : String
    marker      : String
    visitMode   : String
    downward    : boolean
    trail       : java.util.List
    results     : java.util.Map
    confidence  : double
    totalCount  : double
end

declare TreeNode
    context     : String            @key
    id          : String            @key
    parent      : String
    children    : java.util.List
    outcome     : String
    recordCount : int
    counts      : java.util.Map
    confidence  : java.util.Map
    defaultChld : String
end


rule "Mark_RPart_Model"
salience 9999
no-loop
when
//    not ModelMarker( "RPart_Model" ; )
then
    System.out.println( "Marking RPart_Model" );
    ModelMarker mark = new ModelMarker( "RPart_Model", "DecisionTree" );
    insertLogical( mark );
end

rule "Enable/Disable Model"
when
    $flag : Boolean() from entry-point "enable_RPart_Model"
    $mark : ModelMarker( modelName == "RPart_Model", enabled != $flag )
then
	System.out.println( "Enable/Disable Model" );
    retract( $flag );
    modify ( $mark ) {
        setEnabled( $flag );
    }
end


// Display Name : null
 
 declare Probability_Y extends  OutputField 
  @role(event)
  @Traitable

    value : double @key @position(1) 
    displayValue : String =  "Probability_Y" 

    weight : double     = 1.0

     tgtValue : java.lang.String 
 end


rule "update_Probability_Y_RPart_Model"
salience 2000

when
    $new : Probability_Y( $ctx : context ==  "RPart_Model"  )
    $old : Probability_Y( context == $ctx, this before $new )
then
    System.out.println(">>>>>>>>>>>>>> NEED TO KILL " + $old);
    retract( $old );
end


rule "outputFeature_CHK_YN_to_Probability_Y_probability"

when
    $src : CHK_YN(   $v : valid, $wgt : weight,
                            $ctx : context == "RPart_Model", 

                           
                           
                            $x : weight, 

                           $srcVal : value  == "Y" 
                    )
    
then
	System.out.println("outputFeature_CHK_YN_to_Probability_Y_probability 1");
    Probability_Y x = new Probability_Y();
        x.setValue( $x );
        x.setMissing( false );
        x.setValid( $v );
        x.setName( "Probability_Y" );
         x.setContext( $ctx ); 
    insertLogical( x );
end


 // Display Name : null
 
 declare Probability_N extends  OutputField 
  @role(event)
  @Traitable

    value : double @key @position(1) 
    displayValue : String =  "Probability_N" 

    weight : double     = 1.0

     tgtValue : java.lang.String 
 end


rule "update_Probability_N_RPart_Model"
salience 2000

when
    $new : Probability_N( $ctx : context ==  "RPart_Model"  )
    $old : Probability_N( context == $ctx, this before $new )
then
    System.out.println(">>>>>>>>>>>>>> NEED TO KILL " + $old);
    retract( $old );
end


rule "outputFeature_CHK_YN_to_Probability_N_probability"

when
    $src : CHK_YN(   $v : valid, $wgt : weight,
                            $ctx : context == "RPart_Model", 

                           
                           
                            $x : weight, 

                           $srcVal : value  == "N" 
                    )
    
then
	System.out.println("outputFeature_CHK_YN_to_Probability_N_probability 1");
    Probability_N x = new Probability_N();
        x.setValue( $x );
        x.setMissing( false );
        x.setValid( $v );
        x.setName( "Probability_N" );
         x.setContext( $ctx );          
    insertLogical( x );				
	System.out.println("outputFeature_CHK_YN_to_Probability_N_probability 2");
end



--
View this message in context: http://drools.46999.n3.nabble.com/PMML-Exception-excuting-consequence-for-rule-xxx-in-yyy-java-lang-NullPointerException-using-Knowledt-tp4024963p4024997.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list