Package org.drools.core.reteoo

Examples of org.drools.core.reteoo.JoinNode


        kbase1.addKnowledgePackages( buildKnowledgePackage("r2", "   a : A() B() C(2;) D() E()\n") );
        wm.fireAllRules();

        ObjectTypeNode aotn = getObjectTypeNode(kbase1, A.class );
        LeftInputAdapterNode liaNode = (LeftInputAdapterNode) aotn.getSinkPropagator().getSinks()[0];
        JoinNode bNode = (JoinNode) liaNode.getSinkPropagator().getFirstLeftTupleSink();

        JoinNode c1Node = (JoinNode) bNode.getSinkPropagator().getFirstLeftTupleSink();
        JoinNode c2Node = (JoinNode) bNode.getSinkPropagator().getLastLeftTupleSink();

        LiaNodeMemory lm = ( LiaNodeMemory ) wm.getNodeMemory(liaNode);
        SegmentMemory sm = lm.getSegmentMemory();

        BetaMemory c1Mem = ( BetaMemory ) wm.getNodeMemory(c1Node);
View Full Code Here


        kbase1.addKnowledgePackages( buildKnowledgePackage("r2", "   a:A() B() eval(1==1) eval(1==1) C(2;) \n") );
        wm.fireAllRules();

        ObjectTypeNode aotn = getObjectTypeNode(kbase1, A.class );
        LeftInputAdapterNode liaNode = (LeftInputAdapterNode) aotn.getSinkPropagator().getSinks()[0];
        JoinNode bNode = (JoinNode) liaNode.getSinkPropagator().getFirstLeftTupleSink();

        EvalConditionNode e1 = (EvalConditionNode) bNode.getSinkPropagator().getFirstLeftTupleSink();
        EvalConditionNode e2 = (EvalConditionNode) e1.getSinkPropagator().getFirstLeftTupleSink();

        JoinNode c1Node = (JoinNode) e2.getSinkPropagator().getFirstLeftTupleSink();
        JoinNode c2Node = (JoinNode) e2.getSinkPropagator().getLastLeftTupleSink();

        LiaNodeMemory lm = ( LiaNodeMemory ) wm.getNodeMemory(liaNode);
        SegmentMemory sm = lm.getSegmentMemory();

        BetaMemory c1Mem = ( BetaMemory ) wm.getNodeMemory(c1Node);
View Full Code Here

            ksession.insert(i);
            ksession.fireAllRules();
        }

        Rete rete = ((KnowledgeBaseImpl)kbase).getRete();
        JoinNode joinNode = null;
        for (ObjectTypeNode otn : rete.getObjectTypeNodes()) {
            if ( String.class == otn.getObjectType().getValueType().getClassType() ) {
                joinNode = (JoinNode)otn.getSinkPropagator().getSinks()[0];
                break;
            }
View Full Code Here

                .setLeftType( A.class )
                .setBinding( "object", "$object" )
                .setRightType( B.class )
                .setConstraint( "object", "!=", "$object" ).build();

        sinkNode0 = new JoinNode();
        sinkNode0.setId( 1 );
        sinkNode0.setConstraints( new EmptyBetaConstraints() );       
        joinNode.addTupleSink( sinkNode0 );
       
        sinkNode1 = new JoinNode();
        sinkNode1.setId( 2 );
        sinkNode1.setConstraints( new EmptyBetaConstraints() );       
        joinNode.addTupleSink( sinkNode1 );  
       
        sinkNode2 = new JoinNode();
        sinkNode2.setId( 3 );
        sinkNode2.setConstraints( new EmptyBetaConstraints() );       
        joinNode.addTupleSink( sinkNode2 );

        wm = ((StatefulKnowledgeSessionImpl)buildContext.getKnowledgeBase().newStatefulKnowledgeSession());
View Full Code Here

   
    @Test
    public void test1() {
        setupJoinNode();
       
        JoinNode parentNode = joinNode;
        JoinNode child1Node = new JoinNode();
        JoinNode child2Node = new JoinNode();
        JoinNode child3Node = new JoinNode();
       
        parentNode.addTupleSink( child1Node );
        parentNode.addTupleSink( child2Node );
        parentNode.addTupleSink( child3Node );
       
View Full Code Here

            ksession.insert(i);
            ksession.fireAllRules();
        }

        Rete rete = ((KnowledgeBaseImpl)kbase).getRete();
        JoinNode joinNode = null;
        for (ObjectTypeNode otn : rete.getObjectTypeNodes()) {
            if ( String.class == otn.getObjectType().getValueType().getClassType() ) {
                joinNode = (JoinNode)otn.getSinkPropagator().getSinks()[0];
                break;
            }
View Full Code Here

        // Check the network formation, to ensure the RiaNode is shared.
        ObjectTypeNode cheeseOtn = LinkingTest.getObjectTypeNode(kbase, Cheese.class);
        ObjectSink[] oSinks = cheeseOtn.getSinkPropagator().getSinks();
        assertEquals( 1, oSinks.length );

        JoinNode cheeseJoin = ( JoinNode ) oSinks[0];
        LeftTupleSink[] ltSinks = cheeseJoin.getSinkPropagator().getSinks();

        assertEquals( 1, ltSinks.length );
        RightInputAdapterNode rian = ( RightInputAdapterNode ) ltSinks[0];
        assertEquals( 2, rian.getSinkPropagator().size() );   //  RiaNode is shared, if this has two outputs
View Full Code Here

            betaConstraints = new EmptyBetaConstraints();
        }

        switch (nodeType) {
            case NodeTypeEnums.JoinNode:
                return new JoinNode(0, leftInput, rightInput, betaConstraints, buildContext);
            case NodeTypeEnums.NotNode:
                return new NotNode(0, leftInput, rightInput, betaConstraints, buildContext);
            case NodeTypeEnums.ExistsNode:
                return new ExistsNode(0, leftInput, rightInput, betaConstraints, buildContext);
        }
View Full Code Here

                .setLeftType( A.class )
                .setBinding( "object", "$object" )
                .setRightType( B.class )
                .setConstraint( "object", "!=", "$object" ).build();

        sinkNode = new JoinNode();
        sinkNode.setId( 1 );
        sinkNode.setConstraints( new EmptyBetaConstraints() );
       
        joinNode.addTupleSink( sinkNode );
View Full Code Here

                .setLeftType( A.class )
                .setBinding( "object", "$object" )
                .setRightType( B.class )
                .setConstraint( "object", "!=", "$object" ).build();

        sinkNode0 = new JoinNode();
        sinkNode0.setId( 1 );
        sinkNode0.setConstraints( new EmptyBetaConstraints() );       
        joinNode.addTupleSink( sinkNode0 );
       
        sinkNode1 = new JoinNode();
        sinkNode1.setId( 2 );
        sinkNode1.setConstraints( new EmptyBetaConstraints() );       
        joinNode.addTupleSink( sinkNode1 );  
       
        sinkNode2 = new JoinNode();
        sinkNode2.setId( 3 );
        sinkNode2.setConstraints( new EmptyBetaConstraints() );       
        joinNode.addTupleSink( sinkNode2 );

        wm = ((StatefulKnowledgeSessionImpl)buildContext.getKnowledgeBase().newStatefulKnowledgeSession());
View Full Code Here

TOP

Related Classes of org.drools.core.reteoo.JoinNode

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.