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

Examples of com.hp.hpl.jena.sparql.algebra.op.OpBGP


        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


        Var var2 = createNewVar() ;                     // Hidden variable
       
        BasicPattern bp = new BasicPattern() ;
        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
View Full Code Here

    static boolean doFilterPlacement = true ;
   
    public static Op transform(ExprList exprs, BasicPattern bgp)
    {
        if ( ! doFilterPlacement )
            return OpFilter.filter(exprs, new OpBGP(bgp)) ;
       
        Op op = transformFilterBGP(exprs, new HashSet<Var>(), bgp) ;
        // Remaining filters? e.g. ones mentioning var s not used anywhere.
        op = buildFilter(exprs, op) ;
        return op ;
View Full Code Here

        // Any filters that depend on no variables.
        Op op = insertAnyFilter(exprs, patternVarsScope, null) ;
       
        for ( Triple triple : pattern )
        {
            OpBGP opBGP = getBGP(op) ;
            if ( opBGP == null )
            {
                // Last thing was not a BGP (so it likely to be a filter)
                // Need to pass the results from that into the next triple.
                // Which is a join and sequence is a special case of join
                // which always evaluates by passing results of the early
                // part into the next element of the sequence.
               
                opBGP = new OpBGP() ;   
                op = OpSequence.create(op, opBGP) ;
            }
           
            opBGP.getPattern().add(triple) ;
            // Update variables in scope.
            VarUtils.addVarsFromTriple(patternVarsScope, triple) ;
           
            // Attempt to place any filters
            op = insertAnyFilter(exprs, patternVarsScope, op) ;
View Full Code Here

        Var var_x = Var.alloc("x") ;
        Var var_z = Var.alloc("z") ;
       
        // ---- Build expression
        bp.add(new Triple(var_x, NodeFactory.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

  public Op transform(OpBGP opBGP) {
    BasicPattern pattern = opBGP.getPattern();
    if ( pattern.size() < 2 )
        return opBGP ;
    BasicPattern pattern2 = reorder.reorder(pattern);
    return new OpBGP(pattern2);
  }
View Full Code Here

    static private Op flush(BasicPattern bp, Op op)
    {
        if ( bp == null || bp.isEmpty() )
            return op ;
       
        OpBGP opBGP = new OpBGP(bp) ;
        op = OpSequence.create(op, opBGP) ;
        return op ;
    }
View Full Code Here

    private static Op transformFilterBGP(ExprList exprs, Set<Var> patternVarsScope, BasicPattern pattern) {
        // Any filters that depend on no variables.
        Op op = insertAnyFilter(exprs, patternVarsScope, null);

        for (Triple triple : pattern) {
            OpBGP opBGP = getBGP(op);
            if (opBGP == null) {
                // Last thing was not a BGP (so it likely to be a filter)
                // Need to pass the results from that into the next triple.
                // Which is a join and sequence is a special case of join
                // which always evaluates by passing results of the early
                // part into the next element of the sequence.

                opBGP = new OpBGP();
                op = OpSequence.create(op, opBGP);
            }

            opBGP.getPattern().add(triple);
            // Update variables in scope.
            VarUtils.addVarsFromTriple(patternVarsScope, triple);

            // Attempt to place any filters
            op = insertAnyFilter(exprs, patternVarsScope, op);
View Full Code Here

        Var var2 = createNewVar() ;                     // Hidden variable
       
        BasicPattern bp = new BasicPattern() ;
        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
View Full Code Here

        Var var_x = Var.alloc("x") ;
        Var var_z = Var.alloc("z") ;
       
        // ---- Build expression
        bp.add(new Triple(var_x, NodeFactory.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

TOP

Related Classes of com.hp.hpl.jena.sparql.algebra.op.OpBGP

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.