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

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


        Var var_x = Var.alloc("x") ;
        Var var_z = Var.alloc("z") ;
       
        // ---- Build expression
        bp.add(new Triple(var_x, Node.createURI(BASE+"p"), var_z)) ;
        Op op = new OpBGP(bp) ;
        //Expr expr = ExprUtils.parse("?z < 2 ") ;
        Expr expr = new E_LessThan(new ExprVar(var_z), NodeValue.makeNodeInteger(2)) ;
        op = OpFilter.filter(expr, op) ;

        // ---- Example setup
View Full Code Here


        // Parse
        Query query = QueryFactory.create(s) ;
        System.out.println(query) ;
       
        // Generate algebra
        Op op = Algebra.compile(query) ;
        op = Algebra.optimize(op) ;
        System.out.println(op) ;
       
        // Execute it.
        QueryIterator qIter = Algebra.exec(op, Ex1.createModel()) ;
View Full Code Here

        Triple t = new Triple(nodeVar, RDFS.label.asNode(), var2) ;
        bp.add(t) ;
        OpBGP op = new OpBGP(bp) ;
       
        Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
        Op filter = OpFilter.filter(regex, op) ;

        // ---- Evaluation
        if ( true )
        {
            // Use the reference query engine
            // Create a table for the input stream (so it uses working memory at this point,
            // which is why this is not the preferred way). 
            // Then join to expression for this stage.
            Table table = TableFactory.create(input) ;
            Op op2 = OpJoin.create(OpTable.create(table), filter) ;
            return Algebra.exec(op2, execCxt.getDataset()) ;
        }       
       
        // Use the default, optimizing query engine.
        return QC.execute(filter, input, execCxt) ;
View Full Code Here

        ElementGroup elementGroup = new ElementGroup() ;
        elementGroup.addElement(elementBGP) ;
        elementGroup.addElement(new ElementFilter(regex)) ;
        // Compile it.
        // The better design is to build the Op structure programmatically,
        Op op = Algebra.compile(elementGroup) ;
        op = Algebra.optimize(op, execCxt.getContext()) ;
        return QC.execute(op, input, execCxt) ;
    }
View Full Code Here

    { }
   
    @Override
    public Op transform(OpFilter opFilter, Op subOp)
    {
        Op op = apply(opFilter.getExprs(), subOp) ;
        if ( op == null )
            return super.transform(opFilter, subOp) ;
        return op ;
    }
View Full Code Here

        List<Pair<Var, NodeValue>> equalities = p.getLeft() ;
        Collection<Var> varsMentioned = varsMentionedInEqualityFilters(equalities) ;
        ExprList remaining = p.getRight() ;
       
        // ---- Check if the subOp is the right shape to transform.
        Op op = subOp ;
       
        // Special case : deduce that the filter will always "eval unbound"
        // hence elimate all rows.  Return the empty table.
       
        if ( testSpecialCaseUnused(subOp, equalities, remaining))
View Full Code Here

            // If the varsLeft are disjoint from assigned vars,
            // we may be able to push assign down right
            // (this generalises the unit table case specialcase1)
            // Needs more investigation.
           
            Op opLeft = opleftjoin.getLeft() ;
            Set<Var> varsLeft = OpVars.patternVars(opLeft) ;
            if ( varsLeft.containsAll(varsEquality) )
                return true ;
            return false ;
        }       
View Full Code Here

        List<Op> ops2 = new ArrayList<Op>() ;
        Collection<Var> vars = varsMentionedInEqualityFilters(equalities) ;
       
        for ( Op op : ops )
        {
            Op op2 = op ;
            if ( safeToTransform(vars, op) )
            {
                for ( Pair<Var, NodeValue> p : equalities )
                        op2 = processFilterWorker(op, p.getLeft(), p.getRight()) ;
            }
View Full Code Here

        return ops2 ;
    }

    private static Op rebuild(Op2 subOp, List<Op> ops)
    {
        Op chain = OpTable.unit() ;
        for ( Op op : ops )
        {
            chain = subOp.copy(chain, op) ;
        }
        return chain ;
View Full Code Here

        return subst(op, var, constant) ;
    }
   
    private static Op subst(Op subOp , Var var, NodeValue nv)
    {
        Op op = Substitute.substitute(subOp, var, nv.asNode()) ;
        return OpAssign.assign(op, var, nv) ;
    }
View Full Code Here

TOP

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

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.