Package com.hp.hpl.jena.sparql.expr

Examples of com.hp.hpl.jena.sparql.expr.Expr


       
        // ---- 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
        Model m = makeModel() ;
        m.write(System.out, "TTL") ;
View Full Code Here


       
        Triple t1 = new Triple(varX, DC.title.asNode(),  varTitle) ;
        elg.addTriplePattern(t1) ;
       
        // Adds a filter.  Need to wrap variable in a NodeVar.
        Expr expr = new E_Regex(new ExprVar(varTitle), "sparql", "i") ;
        ElementFilter filter = new  ElementFilter(expr) ;
        elg.addElementFilter(filter) ;
       
        // Attach the group to query. 
        query.setQueryPattern(elg) ;
View Full Code Here

        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
        if ( true )
        {
View Full Code Here

        ElementTriplesBlock elementBGP = new ElementTriplesBlock();
        Triple t = new Triple(nodeVar, RDFS.label.asNode(), var2) ;
        elementBGP.addTriple(t) ;
       
        // Regular expression for  regex(?hiddenVar, "pattern", "i")
        Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
       
        ElementGroup elementGroup = new ElementGroup() ;
        elementGroup.addElement(elementBGP) ;
        elementGroup.addElement(new ElementFilter(regex)) ;
        // Compile it.
View Full Code Here

            List<SortCondition> conditions2 = new ArrayList<SortCondition>() ;
            boolean changed = false ;

            for ( SortCondition sc : conditions )
            {
                Expr e = sc.getExpression() ;
                Expr e2 = ExprTransformer.transform(exprTransform, e) ;
                conditions2.add(new SortCondition(e2, sc.getDirection())) ;
                if ( e != e2 )
                    changed = true ;
            }
            OpOrder x = opOrder ;
View Full Code Here

            List<Var> vars = varExpr.getVars() ;
            VarExprList varExpr2 = new VarExprList() ;
            boolean changed = false ;
            for ( Var v : vars )
            {
                Expr e = varExpr.getExpr(v) ;
                Expr e2 =  e ;
                if ( e != null )
                    e2 = ExprTransformer.transform(exprTransform, e) ;
                if ( e2 == null )
                    varExpr2.add(v) ;
                else
View Full Code Here

            {
                Aggregator aggregator = agg.getAggregator() ;
                Var v = agg.getVar() ;
               
                // Variable associated with the aggregate
                Expr eVar = agg.getAggVar() ;   // Not .getExprVar()
                Expr eVar2 = ExprTransformer.transform(exprTransform, eVar) ;
                if ( eVar != eVar2 )
                    changed = true ;

                // The Aggregator expression
                Expr e = aggregator.getExpr() ;
                Expr e2 = e ;
                if ( e != null )    // Null means "no relevant expression" e.g. COUNT(*)
                    ExprTransformer.transform(exprTransform, e) ;
                if ( e != e2 )
                    changed = true ;
                Aggregator a2 = aggregator.copy(e2) ;
View Full Code Here

        {
            ExprList ex = new ExprList() ;
            boolean changed = false ;
            for ( Expr e : opFilter.getExprs() )
            {
                Expr e2 = ExprTransformer.transform(exprTransform, e) ;
                ex.add(e2) ;
                if ( e != e2 )
                    changed = true ;
            }
            OpFilter f = opFilter ;
View Full Code Here

    /** For any expression now in scope, wrap the op with a filter */
    private static Op insertAnyFilter(ExprList exprs, Set<Var> patternVarsScope, Op op)
    {
        for ( Iterator<Expr> iter = exprs.iterator() ; iter.hasNext() ; )
        {
            Expr expr = iter.next() ;
            // Cache
            Set<Var> exprVars = expr.getVarsMentioned() ;
            if ( patternVarsScope.containsAll(exprVars) )
            {
                if ( op == null )
                    op = OpTable.unit() ;
                op = OpFilter.filter(expr, op) ;
View Full Code Here

        if ( exprs.isEmpty() )
            return op ;
   
        for ( Iterator<Expr> iter = exprs.iterator() ; iter.hasNext() ; )
        {
            Expr expr = iter.next() ;
            if ( op == null )
                op = OpTable.unit() ;
            op = OpFilter.filter(expr, op) ;
            iter.remove();
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.expr.Expr

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.