Package org.drools

Examples of org.drools.KnowledgeBase.addKnowledgePackages()


            assertFalse( kbuilder.getErrors().toString(),
                         kbuilder.hasErrors() );

            KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
            kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

            final List<String> results = new ArrayList<String>();
            ksession.setGlobal( "results",
View Full Code Here


            fail( builder.getErrors().toString() );
        }
        final Collection<KnowledgePackage> pkgs = builder.getKnowledgePackages();

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( pkgs );

        kbase = SerializationHelper.serializeObject( kbase );

        StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
View Full Code Here

        builder.add( ResourceFactory.newByteArrayResource( rule.getBytes() ),
                     ResourceType.DRL );

        KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
        try {
            knowledgeBase.addKnowledgePackages( builder.getKnowledgePackages() );
        } catch ( Exception e ) {
            e.printStackTrace();
            fail( "Should execute with out exceptions" );
        }
        StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession();
View Full Code Here

                                                            getClass() ),
                      ResourceType.DRL );
        assertFalse( kbuilder.hasErrors() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
        StatefulKnowledgeSession ksession_1 = kbase.newStatefulKnowledgeSession();
        String expected_1 = "expected_1";
        String expected_2 = "expected_2";
        org.drools.runtime.rule.FactHandle handle_1 = ksession_1.insert( expected_1 );
        org.drools.runtime.rule.FactHandle handle_2 = ksession_1.insert( expected_2 );
View Full Code Here

                                                            getClass() ),
                      ResourceType.DRL );
        assertFalse( kbuilder.hasErrors() );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
        StatefulKnowledgeSession ksession_1 = kbase.newStatefulKnowledgeSession();
        for ( int i = 0; i < 20; i++ ) {
            Object object = new Object();
            ksession_1.insert( object );
            org.drools.runtime.rule.FactHandle factHandle = ksession_1.getFactHandle( object );
View Full Code Here

        if ( kbuilder.hasErrors() ) {
            fail( kbuilder.getErrors().toString() );
        }

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        kbase = SerializationHelper.serializeObject( kbase );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
View Full Code Here

        kbuilder.add( ResourceFactory.newClassPathResource( "test_From.drl",
                                                            getClass() ),
                      ResourceType.DRL );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
        kbase = SerializationHelper.serializeObject( kbase );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        final List list1 = new ArrayList();
        ksession.setGlobal( "list1",
View Full Code Here

        kbuilder.add( ResourceFactory.newClassPathResource( "insurance_pricing_example.drl",
                                                            getClass() ),
                      ResourceType.DRL );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        // now create some test data
        final Driver driver = new Driver();
View Full Code Here

        kbuilder.add( ResourceFactory.newClassPathResource( "test_JoinNodeModifyTuple.drl",
                                                            getClass() ),
                      ResourceType.DRL );

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( ksession,
                                                                              true );
View Full Code Here

        if ( kbuilder.hasErrors() ) {
            fail( kbuilder.getErrors().toString() );
        }

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.