Package com.hp.jena.ymris.deploy.local

Examples of com.hp.jena.ymris.deploy.local.BindingSink.consume()


                { return Triple.create( item[1], item[2], item[3] ); }
            };
        BindingSink input = ruleSet.toCode( reasoner.getHowTo( this ), output );
        input.start();
        for (Iterator<Triple> it = base.find( Triple.ANY ); it.hasNext();)
            input.consume( asBinding( it.next() ) );
        }

    private Node[] asBinding( Triple t )
        { return new Node[] {null, t.getSubject(), t.getPredicate(), t.getObject()}; }
View Full Code Here


        {
        LogBindings sink = new LogBindings();
        String rules = "RULE { [<eh:/P> ?x] <eh:/Q> ?y } => { ?x <eh:/PQ> ?y }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        in.consume( nodeArray( "X a P x" ) );
        in.consume( nodeArray( "X a Q y" ) );
        in.consume( nodeArray( "X b P x" ) );
        assertEquals( bindings( "x PQ y" ), sink.bindings );
        }
    }
View Full Code Here

        LogBindings sink = new LogBindings();
        String rules = "RULE { [<eh:/P> ?x] <eh:/Q> ?y } => { ?x <eh:/PQ> ?y }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        in.consume( nodeArray( "X a P x" ) );
        in.consume( nodeArray( "X a Q y" ) );
        in.consume( nodeArray( "X b P x" ) );
        assertEquals( bindings( "x PQ y" ), sink.bindings );
        }
    }

View Full Code Here

    @Test public void testActionWithConclusion()
        {
        String rules = "RULE { ?x <eh:/P> ?y } => DO spoo(?x, ?y) { ?x a <eh:/PD> }";
        BindingSink in = rulesToDeployment( sink, rules, new A( nodes ) );
    //
        in.consume( nodeArray( "X S P O" ) );
        assertEquals( bindings( "S rdf:type PD" ), sink.bindings );
        assertEquals( bindings( "S O" ).get( 0 ), nodes );
        }
       
    @Test public void testActionWithEmptyConclusion()
View Full Code Here

    @Test public void testActionWithEmptyConclusion()
        {
        String rules = "RULE { ?x <eh:/P> ?y } => DO spoo(?x, ?y) {}";
        BindingSink in = rulesToDeployment( sink, rules, new A( nodes ) );
    //
        in.consume( GraphTestBase.nodeArray( "X S P O" ) );
        assertEquals( bindings( "" ), sink.bindings );
        assertEquals( bindings( "S O" ).get( 0 ), nodes );
        }
    }
View Full Code Here

        {
        LogBindings sink = new LogBindings();
        String rules = "RULE { ?x <eh:/P> ?y FILTER 1 > 0 } => { <eh:/P> a <eh:/Neg>  }";
        BindingSink in = Utils.rulesToDeployment( sink, rules, howTo );
    //
        in.consume( GraphTestBase.nodeArray( "X 1 P '-1'xsd:integer" ) );
        assertEquals( Utils.bindings( "P rdf:type Neg" ), sink.bindings );
        }
    }

View Full Code Here

        {
        String rules =
            "RULE { ?x ?P ?y FILTER ?x = <eh:/x> && ?y = <eh:/y> } => { ?P <eh:/is> <eh:/xy> }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( nodeArray( "X x P y" ) );
        assertEquals( bindings( "P is xy" ), sink.bindings );
        }
   
    @Test public void testOrFilters()
        {
View Full Code Here

        String rules =
            "RULE { ?x ?P ?y FILTER (?x = <eh:/x>) || (?y = <eh:/y>) } => { ?P <eh:/is> <eh:/xory> }"
            + " ";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( nodeArray( "X x P z" ) );
        in.consume( nodeArray( "X z Q y" ) );
        in.consume( nodeArray( "X x R y" ) );
        in.consume( nodeArray( "X z S z" ) );
        assertEquals( bindings( "P is xory; Q is xory; R is xory" ), sink.bindings );
        }
View Full Code Here

            "RULE { ?x ?P ?y FILTER (?x = <eh:/x>) || (?y = <eh:/y>) } => { ?P <eh:/is> <eh:/xory> }"
            + " ";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( nodeArray( "X x P z" ) );
        in.consume( nodeArray( "X z Q y" ) );
        in.consume( nodeArray( "X x R y" ) );
        in.consume( nodeArray( "X z S z" ) );
        assertEquals( bindings( "P is xory; Q is xory; R is xory" ), sink.bindings );
        }
    }
View Full Code Here

            + " ";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( nodeArray( "X x P z" ) );
        in.consume( nodeArray( "X z Q y" ) );
        in.consume( nodeArray( "X x R y" ) );
        in.consume( nodeArray( "X z S z" ) );
        assertEquals( bindings( "P is xory; Q is xory; R is xory" ), sink.bindings );
        }
    }
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.