use of org.kie.api.definition.type.FactType in project drools by kiegroup.
the class UserDefinedFunctionsTest method testFunctions0.
@Test
public void testFunctions0() throws Exception {
setKSession(getModelSession(source0, VERBOSE));
setKbase(getKSession().getKieBase());
FactType userAge1 = getKbase().getFactType(packageName, "UserAge");
PMMLRequestData request = new PMMLRequestData("TestSimple");
request.addRequestParam("Age", 2.2);
getKSession().insert(request);
// getKSession().getEntryPoint( "in_Age" ).insert( 2.2 );
getKSession().fireAllRules();
System.out.println(reportWMObjects(getKSession()));
checkFirstDataFieldOfTypeStatus(userAge1, true, false, null, 22.0);
checkGeneratedRules();
}
use of org.kie.api.definition.type.FactType in project drools by kiegroup.
the class UserDefinedFunctionsTest method testFunctions2.
@Test
public void testFunctions2() throws Exception {
setKSession(getModelSession(source3, VERBOSE));
setKbase(getKSession().getKieBase());
FactType userAge2 = getKbase().getFactType(packageName, "UserAge2");
getKSession().getEntryPoint("in_Age").insert(10);
getKSession().fireAllRules();
checkFirstDataFieldOfTypeStatus(userAge2, true, false, null, 0.1);
checkGeneratedRules();
}
use of org.kie.api.definition.type.FactType in project drools by kiegroup.
the class UserDefinedFunctionsTest method testFunctionsNested.
@Test
public void testFunctionsNested() throws Exception {
setKSession(getModelSession(source1, VERBOSE));
setKbase(getKSession().getKieBase());
FactType userAge1 = getKbase().getFactType(packageName, "UserAge");
getKSession().getEntryPoint("in_Age").insert(10.0);
getKSession().fireAllRules();
System.out.println(reportWMObjects(getKSession()));
checkFirstDataFieldOfTypeStatus(userAge1, true, false, null, 130.0);
checkGeneratedRules();
}
use of org.kie.api.definition.type.FactType in project drools by kiegroup.
the class SVMTest method testSVM1vN.
@Test
public void testSVM1vN() throws Exception {
setKSession(getModelSession(source2, VERBOSE));
setKbase(getKSession().getKieBase());
KieSession kSession = getKSession();
// init model
kSession.fireAllRules();
FactType ztype = kSession.getKieBase().getFactType(packageName, "Z");
assertNotNull(ztype);
kSession.getEntryPoint("in_X").insert(0.0);
kSession.getEntryPoint("in_Y").insert(0.0);
kSession.fireAllRules();
checkFirstDataFieldOfTypeStatus(ztype, true, false, "SVMXORMODEL", "no");
checkFirstDataFieldOfTypeStatus(kSession.getKieBase().getFactType(packageName, "OutZ"), true, false, "SVMXORMODEL", "no");
checkFirstDataFieldOfTypeStatus(kSession.getKieBase().getFactType(packageName, "ProbZNo"), true, false, "SVMXORMODEL", 0.7357588);
checkGeneratedRules();
}
use of org.kie.api.definition.type.FactType in project drools by kiegroup.
the class SVMTest method testSVM.
@Test
public void testSVM() throws Exception {
setKSession(getModelSession(source1, VERBOSE));
setKbase(getKSession().getKieBase());
KieSession kSession = getKSession();
// init model
kSession.fireAllRules();
FactType ztype = kSession.getKieBase().getFactType(packageName, "Z");
assertNotNull(ztype);
kSession.getEntryPoint("in_X").insert(0.0);
kSession.getEntryPoint("in_Y").insert(0.0);
kSession.fireAllRules();
System.out.println(reportWMObjects(kSession));
checkFirstDataFieldOfTypeStatus(ztype, true, false, "SVMXORMODEL", "yes");
kSession.getEntryPoint("in_X").insert(0.23);
kSession.getEntryPoint("in_Y").insert(0.75);
kSession.fireAllRules();
checkFirstDataFieldOfTypeStatus(ztype, true, false, "SVMXORMODEL", "no");
kSession.getEntryPoint("in_X").insert(0.85);
kSession.fireAllRules();
checkFirstDataFieldOfTypeStatus(ztype, true, false, "SVMXORMODEL", "yes");
kSession.getEntryPoint("in_Y").insert(-0.12);
kSession.fireAllRules();
checkFirstDataFieldOfTypeStatus(ztype, true, false, "SVMXORMODEL", "no");
kSession.getEntryPoint("in_X").insert(7.85);
kSession.fireAllRules();
System.out.println(reportWMObjects(kSession));
checkFirstDataFieldOfTypeStatus(ztype, true, false, "SVMXORMODEL", "no");
checkGeneratedRules();
}
Aggregations