Package org.kie.api.runtime

Examples of org.kie.api.runtime.ClassObjectFilter


        KieSession kSession = ks.newKieContainer( ks.getRepository().getDefaultReleaseId() ).newKieSession();

        kSession.fireAllRules();

        assertEquals( 2, kSession.getObjects( new ClassObjectFilter( ModelMarker.class ) ).size() );
        assertEquals( 11, kSession.getObjects( new ClassObjectFilter( kSession.getKieBase().getFactType( packageName, "Synapse" ).getFactClass() ) ).size() );

        kSession.dispose();
    }
View Full Code Here


        IncrementalResults results = (( InternalKieBuilder ) kb ).incrementalBuild();
        kc.updateToVersion( releaseId1 );

        kSession.fireAllRules();

        assertEquals( 2, kSession.getObjects( new ClassObjectFilter( ModelMarker.class ) ).size() );
        assertEquals( 11, kSession.getObjects( new ClassObjectFilter( kSession.getKieBase().getFactType( packageName, "Synapse" ).getFactClass() ) ).size() );

        kSession.dispose();
    }
View Full Code Here

   
   
    protected Object getToken( KieSession kSession ) {
        FactType tok = kSession.getKieBase().getFactType( PMML4Helper.pmmlDefaultPackageName(), "TreeToken" );
        assertNotNull( tok );
        Collection c = kSession.getObjects( new ClassObjectFilter( tok.getFactClass() ) );
        assertEquals( 1, c.size() );
        return c.iterator().next();
    }
View Full Code Here

        Object token = getToken( kSession );
        assertEquals( 0.0, (Double) tok.get( token, "confidence" ), 1e-6 );
        assertEquals( "null", tok.get( token, "current" ) );
        assertEquals( 0.0, tok.get( token, "totalCount" ) );

        assertEquals( 0, getKSession().getObjects( new ClassObjectFilter( tgt.getFactClass() ) ).size() );
    }
View Full Code Here

        amklaims_ep.insert(9);

        getKSession().fireAllRules();

        assertEquals( 6, getKSession().getObjects().size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( gender.getFactClass() ) ).size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( noclaims.getFactClass() ) ).size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( scrambled.getFactClass() ) ).size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( domicile.getFactClass() ) ).size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( agecar.getFactClass() ) ).size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( amklaims.getFactClass() ) ).size() );


        checkFirstDataFieldOfTypeStatus(amklaims,true,false, null,9);

        checkFirstDataFieldOfTypeStatus(domicile,false,false,null,"way out");
View Full Code Here

        checkFirstDataFieldOfTypeStatus( userAge2, true, false, null, 44.1 );

        System.out.println( "_________________________________________________________________" );

        FactType age = getKbase().getFactType( packageName, "Age" );
        Object aged = getKSession().getObjects( new ClassObjectFilter( age.getFactClass() ) ).iterator().next();

        getKSession().delete( getKSession().getFactHandle( aged ) );
        getKSession().fireAllRules();

        assertEquals( 0, getKSession().getFactCount() );
View Full Code Here

        kSession.getEntryPoint( "in_Fld2" ).insert( -1.0 );

        kSession.fireAllRules();
       
        FactType mu = kSession.getKieBase().getFactType( packageName, "DistanceMembership" );
        Collection mus = kSession.getObjects( new ClassObjectFilter( mu.getFactClass()) );
        assertTrue( mus.size() > 0 );
        for ( Object x : mus ) {
            Integer ix = (Integer) mu.get( x, "index" );
            String lab = (String) mu.get( x, "label" );
            Double m = (Double) mu.get( x, "mu" );
View Full Code Here

        FactType out1 = getKbase().getFactType("org.drools.pmml.pmml_4_2.test","Out1");
        FactType out2 = getKbase().getFactType("org.drools.pmml.pmml_4_2.test","Out2");
        FactType nump = getKbase().getFactType("org.drools.pmml.pmml_4_2.test","Feat2");

        assertEquals(1,getKSession().getObjects(new ClassObjectFilter(out1.getFactClass())).size());
        assertEquals(1,getKSession().getObjects(new ClassObjectFilter(out2.getFactClass())).size());
        assertEquals(2,getKSession().getObjects(new ClassObjectFilter(nump.getFactClass())).size());



        getKSession().getEntryPoint( "in_Feat1" ).insert(2.5);
        getKSession().getEntryPoint( "in_Feat2" ).insert(6);
        getKSession().fireAllRules();


        //System.err.println(reportWMObjects(getKSession()));

        assertEquals(1,getKSession().getObjects(new ClassObjectFilter(out1.getFactClass())).size());
        assertEquals(1,getKSession().getObjects(new ClassObjectFilter(out2.getFactClass())).size());
        assertEquals(2,getKSession().getObjects(new ClassObjectFilter(nump.getFactClass())).size());


    }
View Full Code Here



    private int getNumAssertedSynapses() {
        Class<?> synClass = getKSession().getKieBase().getFactType( PMML4Helper.pmmlDefaultPackageName(),"Synapse").getFactClass();
        return getKSession().getObjects(new ClassObjectFilter(synClass)).size();
    }
View Full Code Here

        kSession.fireAllRules()//init model

        FactType scoreCardType = getKbase().getFactType( PMML4Helper.pmmlDefaultPackageName(), "ScoreCard" );
        assertNotNull( scoreCardType );

        assertEquals( 1, kSession.getObjects( new ClassObjectFilter( scoreCardType.getFactClass() ) ).size() );
        Object scoreCard = kSession.getObjects( new ClassObjectFilter( scoreCardType.getFactClass() ) ).iterator().next();

        System.out.printreportWMObjects( kSession )
        );
        assertEquals( "SampleScore", scoreCardType.get( scoreCard, "modelName" ) );
        assertEquals( 41.345, scoreCardType.get( scoreCard, "score" ) );
View Full Code Here

TOP

Related Classes of org.kie.api.runtime.ClassObjectFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.