Package com.hp.hpl.jena.sparql.algebra

Examples of com.hp.hpl.jena.sparql.algebra.Table


    }

    @Override
    public void visit(OpExtend opExtend)
    {
        Table table = eval(opExtend.getSubOp()) ;
        table = evaluator.extend(table, opExtend.getVarExprList()) ;
        push(table) ;
    }
View Full Code Here


    }

    @Override
    public void visit(OpGroup opGroup)
    {
        Table table = eval(opGroup.getSubOp()) ;
        table = evaluator.groupBy(table, opGroup.getGroupVars(), opGroup.getAggregators()) ;
        push(table) ;
    }
View Full Code Here

{
    public static Table eval(Evaluator evaluator, Op op)
    {
        EvaluatorDispatch ev = new EvaluatorDispatch(evaluator) ;
        op.visit(ev) ;
        Table table = ev.getResult() ;
        return table ;
    }
View Full Code Here

            return eval(e2, opGraph.getSubOp()) ;
        }
       
        // Graph node is a variable.
        Var gVar = Var.alloc(opGraph.getNode()) ;
        Table current = null ;
        for ( Iterator<Node> iter = execCxt.getDataset().listGraphNodes() ; iter.hasNext() ; )
        {
            Node gn = iter.next();
            Graph graph = execCxt.getDataset().getGraph(gn) ;
            ExecutionContext execCxt2 = new ExecutionContext(execCxt, graph) ;
            Evaluator e2 = EvaluatorFactory.create(execCxt2) ;
           
            Table tableVarURI = TableFactory.create(gVar, gn) ;
            // Evaluate the pattern, join with this graph node possibility.
            // XXX If Var.ANON then no-opt.
            Table patternTable = eval(e2, opGraph.getSubOp()) ;
            Table stepResult = evaluator.join(patternTable, tableVarURI) ;
           
            if ( current == null )
                current = stepResult ;
            else
                current = evaluator.union(current, stepResult) ;
View Full Code Here

                Binding b = BindingFactory.binding(BindingRoot.create(), gVar, gn) ;
                ExecutionContext cxt2 = new ExecutionContext(cxt, g) ;

                // Eval the pattern, eval the variable, join.
                // Pattern may be non-linear in the variable - do a pure execution. 
                Table t1 = TableFactory.create(gVar, gn) ;
                QueryIterator qIter = executeBGP(pattern, QueryIterRoot.create(cxt2), cxt2) ;
                Table t2 = TableFactory.create(qIter) ;
                Table t3 = evaluator.join(t1, t2) ;
                concat.add(t3.iterator(cxt2)) ;
            }
            return TableFactory.create(concat) ;
        }
    }
View Full Code Here

   
    @Override public Op transform(OpTable opTable)
    {
        if ( opTable.isJoinIdentity() )
            return opTable ;
        Table table = opTable.getTable() ;
        if ( table.isEmpty() )
            return opTable ;
        if ( TableUnit.isTableUnit(table) )
            return opTable ;
        if ( table.getVars().size() == 0 )
            return opTable ;
        Table table2 = NodeTransformLib.transform(table, transform) ;
        return OpTable.create(table2) ;
    }
View Full Code Here

    public boolean equals(Object other) {
        if ( this == other )
            return true ;
        if ( !(other instanceof Table) )
            return false ;
        Table table = (Table)other ;
        if ( table.size() != this.size() )
            return false ;
        QueryIterator qIter1 = iterator(null) ;
        QueryIterator qIter2 = table.iterator(null) ;
        try {
            for (; qIter1.hasNext();) {
                Binding bind1 = qIter1.nextBinding() ;
                Binding bind2 = qIter2.nextBinding() ;
                if ( !BindingBase.equals(bind1, bind2) )
View Full Code Here

    public static boolean isJoinIdentify(Op op)
    {
        if ( ! ( op instanceof OpTable ) )
            return false ;
        Table t = ((OpTable)op).getTable() ;
        // Safe answer.
        return TableUnit.isTableUnit(t) ;
    }
View Full Code Here

    {
        Node gn = opDatasetNames.getGraphNode() ;
        if ( gn.isVariable() )
        {
            // Answer is a table.
            Table t = TableFactory.create() ;
            Var v = Var.alloc(gn) ;
            for ( Node n : namedGraphs )
            {
                Binding b = BindingFactory.binding(v, n) ;
                t.addBinding(b) ;
            }
            return OpTable.create(t) ;
        }
        // Not a variable.
        if ( ! namedGraphs.contains(gn) )
View Full Code Here

   
    public static boolean isJoinIdentify(Op op)
    {
        if ( ! ( op instanceof OpTable ) )
            return false ;
        Table t = ((OpTable)op).getTable() ;
        // Safe answer.
        return (t instanceof TableUnit) ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.algebra.Table

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.