[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:35:26 EDT 2013


package Meritz_ModelRule_01;

import org.drools.pmml.pmml_4_1.ModelMarker;
import org.drools.pmml.pmml_4_1.PMML4AbstractField;


query modelMarker( String $model, ModelMarker $mm )
    $mm := ModelMarker( $model ; )
end


declare PMML4AbstractField
end


declare DataField extends PMML4AbstractField
 @role(event)
   valid : boolean   = false      @position(3)
   missing : boolean  = false     @position(4)
   context : String @key          @position(2)
   name    : String
//   cyclic = (false) : boolean
//   continuous = (false) : boolean
//   categorical = (false) : boolean
//   ordinal = (false) : boolean
end


declare OutputField extends DataField
@role(event)

    warning  : String = "No Warning"
    target   : boolean  = false

end

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

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

    weight : double     = 1.0

    
 end


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


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


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

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

    weight : double     = 1.0

    
 end


rule "Valid_Values_AGE_GRD"

no-loop
salience 9999
when
    $in : AGE_GRD( $val : value, valid == false,
          
           value == "10대"  ||  value == "20대"  ||  value == "70대이상"  || 
value == "기타" 
          )
then
    System.out.println("--- Invalid -> valid " + $in);
    modify ( $in ) {
        setValid( true );
    }
end


rule "Input_AGE_GRD"
when
    $in : java.lang.String() from entry-point "in_AGE_GRD"
    not AGE_GRD( value == $in, context == null )
then
    // java.lang.String
    AGE_GRD input = new AGE_GRD();
        input.setValue( $in );
        input.setName("AGE_GRD");
        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_AGE_GRD"
salience 2
when
    $new: java.lang.String() from entry-point "in_AGE_GRD"
    $old: AGE_GRD( value != $new )
then
    System.out.println(" Overriding previous values " + $old + " because of
" + $new );
    retract( $old );
end


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

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

    weight : double     = 1.0

    
 end


rule "Valid_Values_FDS_AC_YN"

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


rule "Input_FDS_AC_YN"
when
    $in : java.lang.String() from entry-point "in_FDS_AC_YN"
    not FDS_AC_YN( value == $in, context == null )
then
    // java.lang.String
    FDS_AC_YN input = new FDS_AC_YN();
        input.setValue( $in );
        input.setName("FDS_AC_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



--
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-tp4024963p4024994.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list