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

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


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


    {
    @Test public void testYmrisBlankNodeWithOnePropertyInPremise()
        {
        LogBindings sink = new LogBindings();
        String rules = "RULE { [] <eh:/P> ?y } => { ?y a <eh:/Presented> }";
        BindingSink in = Utils.rulesToDeployment( sink, rules );
        in.consume( nodeArray( "X a P b" ) );
        assertEquals( bindings( "b rdf:type Presented" ), sink.bindings );
        }
View Full Code Here

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

    public BindingSink toCode( HowTo howTo, BindingSink out )
        {  
        final Set<Binding> deductions = new HashSet<Binding>();
        final List<Node[]> queue = new ArrayList<Node[]>();
        BindingSink sink = new BindingSink.Filter( out )
            {           
            @Override public void consume( Node[] item )
                {
                if (deductions.add( new Binding( item ) ) )
                    {
                    sink.consume( item );
                    queue.add( item );
                    }
                }
            };
        PrefixMapping pm = createPrefixMapping().withDefaultMappings( PrefixMapping.Standard );
        List<BindingSink> inputs = new ArrayList<BindingSink>();
        for (Rule r: rules) inputs.add( r.toCode( pm, howTo, sink ) );
        BindingSink fanOut = BindingSink.toAll( inputs )
        return new BindingSink.Filter( fanOut )
            {
            @Override public void start()
                { sink.start(); }
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.