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

Examples of com.hp.jena.ymris.deploy.local.BindingSink$Filter


        }

    public static BindingSink rulesToDeployment( BindingSink sink, String rules, HowTo h )
        {
        RuleSet ruleSet = parseRuleSet( rules ).ruleSets().get( 0 );
        BindingSink result = ruleSet.toCode( h, sink );
        result.start();
        return result;
        }
View Full Code Here


    {
    @Test public void testAggregation()
        {
        LogBindings sink = new LogBindings();
        String rules = "RULE {ALL ?x. {?x <eh:/P> ?y}} => { <eh:/P> <my:count> count(?x) }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( GraphTestBase.nodeArray( "X a P b" ) );
        in.consume( GraphTestBase.nodeArray( "X b Q c" ) );
        in.consume( GraphTestBase.nodeArray( "X x P y" ) );
        in.finish();
        assertEquals( Utils.bindings( "P my:count 2" ), sink.bindings );
        }
View Full Code Here

   
    @Test public void testInfixAddFilter()
        {
        LogBindings sink = new LogBindings();
        String rules = "RULE {  ?x <eh:/P> ?y FILTER ?x = ?y + ?y } => { <eh:/P> a <eh:/Half>  }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( nodeArray( "X 2 P 1" ) );
        assertEquals( Utils.bindings( "P rdf:type Half" ), sink.bindings );
        }
View Full Code Here

   
    @Test public void testPrefixMinusFilter()
        {
        LogBindings sink = new LogBindings();
        String rules = "RULE {  ?x <eh:/P> ?y FILTER ?x = -?y } => { <eh:/P> a <eh:/Neg>  }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( nodeArray( "X 1 P '-1'xsd:integer" ) );
        assertEquals( Utils.bindings( "P rdf:type Neg" ), sink.bindings );
        }
View Full Code Here

        }

    @Test public void testToBothConsumesToBoth()
        {
        LogBindings L = new LogBindings(), R = new LogBindings();
        BindingSink both = BindingSink.toBoth( L, R );
        Node [] binding = new Node[] {null, GraphTestBase.node( "A" )};
        both.consume( binding );
        assertEquals( Utils.bindings( "A" ), L.bindings );
        assertEquals( Utils.bindings( "A" ), R.bindings );
        assertFalse( L.startCalled );
        assertFalse( L.finishCalled );
        assertFalse( R.startCalled );
View Full Code Here

        }
   
    @Test public void testToBothStartsBoth()
        {
        LogBindings L = new LogBindings(), R = new LogBindings();
        BindingSink both = BindingSink.toBoth( L, R );
        both.start();
        assertTrue( L.startCalled );
        assertFalse( L.finishCalled );
        assertTrue( R.startCalled );
        assertFalse( R.finishCalled );
        }
View Full Code Here

        }
   
    @Test public void testToBothFinishesBoth()
        {
        LogBindings L = new LogBindings(), R = new LogBindings();
        BindingSink both = BindingSink.toBoth( L, R );
        both.finish();
        assertFalse( L.startCalled );
        assertTrue( L.finishCalled );
        assertFalse( R.startCalled );
        assertTrue( R.finishCalled );
        }
View Full Code Here

        }
   
    @Test public void testBindingSinkFilterPropagatesStart()
        {
        LogBindings L = new LogBindings();
        BindingSink F = new FilterBoom( L );
        F.start();
        assertTrue( L.startCalled );
        assertFalse( L.finishCalled );
        }
View Full Code Here

        }
   
    @Test public void testBindingSinkFilterPropagatesFinish()
        {
        LogBindings L = new LogBindings();
        BindingSink F = new FilterBoom( L );
        F.finish();
        assertFalse( L.startCalled );
        assertTrue( L.finishCalled );
        }
View Full Code Here

    {
    @Test public void testMultipleConclusions()
        {
        LogBindings sink = new LogBindings();
        String rules = "RULE { ?x <eh:/P> ?y } => { ?x a <eh:/PD>. ?y a <eh:/PR> }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( GraphTestBase.nodeArray( "X S P O" ) );
        assertEquals( Utils.bindings( "S rdf:type PD; O rdf:type PR" ), sink.bindings );
        }
View Full Code Here

TOP

Related Classes of com.hp.jena.ymris.deploy.local.BindingSink$Filter

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.