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

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


        {
        LogBindings sink = new LogBindings();
        String rules = "RULE {?x a <eh:/HasP> } => { ?x <eh:/P> [] }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        in.consume( nodeArray( "X x rdf:type HasP" ) );
        in.consume( nodeArray( "X x rdf:type HasP" ) );
        assertEquals( 1, sink.bindings.size() );
        Node blankA = sink.bindings.get(0).get(3);
        assertTrue( blankA.isBlank() );
        }
    }
View Full Code Here


   
    @Test public void testLetSettingObjectValue()
        {
        String rules = "RULE { LET ?x = 1 ?a ?P ?x } => { ?a a <my:One> }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        in.consume( nodeArray( "X a P 1" ) );
        in.consume( nodeArray( "X b P 2" ) );
        assertEquals( bindings( "a rdf:type my:One" ), sink.bindings );
        }
    }
View Full Code Here

    @Test public void testLetSettingObjectValue()
        {
        String rules = "RULE { LET ?x = 1 ?a ?P ?x } => { ?a a <my:One> }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        in.consume( nodeArray( "X a P 1" ) );
        in.consume( nodeArray( "X b P 2" ) );
        assertEquals( bindings( "a rdf:type my:One" ), sink.bindings );
        }
    }

/*
 
View Full Code Here

            "RULE { ?x ?P ?y FILTER before( ?x, ?y ) } => { ?x <eh:/p-before> ?y }"
            + " RULE { ?x ?P ?y FILTER before( ?y, ?x ) } => { ?y <eh:/p-before> ?x }"
            ;
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( GraphTestBase.nodeArray( "X x P y" ) );
        assertEquals( Utils.bindings( "x p-before y" ), sink.bindings );
        }
   
    @Test public void testQualifiedFunctionalFilters()
        {
View Full Code Here

        String rules =
            "RULE PREFIX my: <eh:/my#> { ?x ?P ?y FILTER my:before( ?x, ?y ) } => { ?x <eh:/p-before> ?y }"
            ;
        BindingSink in = Utils.rulesToDeployment( sink, rules );
    //
        in.consume( GraphTestBase.nodeArray( "X x P y" ) );
        assertEquals( Utils.bindings( "x p-before y" ), sink.bindings );
        }
    }

/*
 
View Full Code Here

        {
        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

        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

        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

        {
        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 );
        }
   
    @Test public void testPrefixMinusFilter()
        {
View Full Code Here

        {
        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

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.