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

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


    {
    @Test public void testYmrisBlankNodeInConclusion()
        {
        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" ) );
        assertEquals( 1, sink.bindings.size() );
        List<Node> bound = sink.bindings.get(0);
        assertEquals( node( "x" ), bound.get(1) );
        assertEquals( node( "P" ), bound.get(2) );
        assertTrue( bound.get(3).isBlank() );
View Full Code Here


        }   
    @Test public void testDifferentBindingsGenerateDifferentBNodes()
        {
        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 y rdf:type HasP" ) );
        assertEquals( 2, sink.bindings.size() );
        Node blankA = sink.bindings.get(0).get(3);
        Node blankB = sink.bindings.get(1).get(3);
        assertTrue( blankA.isBlank() );
        assertTrue( blankB.isBlank() );
View Full Code Here

   
    @Test public void testSameBindingsGenerateSameBNodes()
        {
        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

    protected final LogBindings sink = new LogBindings();
   
    @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

    protected final LogBindings sink = new LogBindings();
   
    @Test public void testLetActions()
        {
        String rules = "RULE { } => LET ?x = 17 { <eh:/x> <eh:/hasValue> ?x }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        assertEquals( bindings( "x hasValue 17" ), sink.bindings );
        }
View Full Code Here

        LogBindings sink = new LogBindings();
        String rules =
            "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 );
        }
View Full Code Here

        {
        LogBindings sink = new LogBindings();
        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

    {
    @Test public void testYmrisAxioms()
        {
        LogBindings sink = new LogBindings();
        String rules = "RULE {} => { <eh:/x> a <eh:/XType> }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        assertEquals( bindings( "x rdf:type XType" ), sink.bindings );
        }
View Full Code Here

    protected final LogBindings sink = new LogBindings();
   
    @Test public void testX()
        {
        String rules = "RULE { } => { <eh:/x> <eh:/hasValue> valof(1) }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        assertEquals( bindings( "x hasValue 1" ), sink.bindings );
        }
View Full Code Here

        }

    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

TOP

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

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.