public static Expr substitute(Expr expr, Binding binding) { if ( isNotNeeded(binding) ) return expr ; return expr.copySubstitute(binding) ; }
public static Expr substitute(Expr expr, Binding binding) { if ( isNotNeeded(binding) ) return expr ; return expr.copySubstitute(binding) ; }
public ExprList copySubstitute(Binding binding, boolean foldConstants) { ExprList x = new ExprList() ; for ( Iterator<Expr> iter = expressions.iterator() ; iter.hasNext() ; ) { Expr expr = iter.next(); expr = expr.copySubstitute(binding, foldConstants) ; x.add(expr) ; } return x ; } public void addAll(ExprList exprs) { expressions.addAll(exprs.getList()) ; }
public ExprList copySubstitute(Binding binding, boolean foldConstants) { ExprList x = new ExprList() ; for ( Iterator<Expr> iter = expressions.iterator() ; iter.hasNext() ; ) { Expr expr = iter.next(); expr = expr.copySubstitute(binding, foldConstants) ; x.add(expr) ; } return x ; } public void addAll(ExprList exprs) { expressions.addAll(exprs.getList()) ; }
@Override public void visit(ElementFilter filter) { com.hp.hpl.jena.sparql.expr.Expr expr = filter.getExpr(); expr = expr.copySubstitute(this); result = new ElementFilter(expr); }
@Override final public Expr copySubstitute(Binding binding, boolean foldConstants) { Expr e1 = (expr1 == null ? null : expr1.copySubstitute(binding, foldConstants)) ; Expr e2 = (expr2 == null ? null : expr2.copySubstitute(binding, foldConstants)) ; Expr e3 = (expr3 == null ? null : expr3.copySubstitute(binding, foldConstants)) ; if ( foldConstants) { try { if ( e1 != null && e2 != null && e3 != null && e1.isConstant() && e2.isConstant() && e3.isConstant() ) return eval(e1.getConstant(), e2.getConstant(), e3.getConstant()) ; } catch (ExprEvalException ex) { /* Drop through */ } } return copy(e1, e2, e3) ; }
@Override final public Expr copySubstitute(Binding binding, boolean foldConstants) { Expr e1 = (expr1 == null ? null : expr1.copySubstitute(binding, foldConstants)) ; Expr e2 = (expr2 == null ? null : expr2.copySubstitute(binding, foldConstants)) ; if ( foldConstants) { try { if ( e1 != null && e2 != null && e1.isConstant() && e2.isConstant() ) return eval(e1.getConstant(), e2.getConstant()) ; } catch (ExprEvalException ex) { /* Drop through */ } } return copy(e1, e2) ; }
@Override public void visit(ElementAssign assign) { com.hp.hpl.jena.sparql.expr.Expr expr = assign.getExpr().copySubstitute(this); Var v = assign.getVar(); result = new ElementAssign(v, expr); }
@Override public void visit(ElementBind eb) { com.hp.hpl.jena.sparql.expr.Expr expr = eb.getExpr().copySubstitute(this); Var v = eb.getVar(); result = new ElementBind(v, expr); }
@Override final public Expr copySubstitute(Binding binding, boolean foldConstants) { Expr e1 = (expr1 == null ? null : expr1.copySubstitute(binding, foldConstants)) ; Expr e2 = (expr2 == null ? null : expr2.copySubstitute(binding, foldConstants)) ; if ( foldConstants) { try { if ( e1 != null && e2 != null && e1.isConstant() && e2.isConstant() ) return eval(e1.getConstant(), e2.getConstant()) ; } catch (ExprEvalException ex) { /* Drop through */ } } return copy(e1, e2) ; }
@Override final public Expr copySubstitute(Binding binding, boolean foldConstants) { Expr e1 = (expr1 == null ? null : expr1.copySubstitute(binding, foldConstants)) ; Expr e2 = (expr2 == null ? null : expr2.copySubstitute(binding, foldConstants)) ; Expr e3 = (expr3 == null ? null : expr3.copySubstitute(binding, foldConstants)) ; if ( foldConstants) { try { if ( e1 != null && e2 != null && e3 != null && e1.isConstant() && e2.isConstant() && e3.isConstant() ) return eval(e1.getConstant(), e2.getConstant(), e3.getConstant()) ; } catch (ExprEvalException ex) { /* Drop through */ } } return copy(e1, e2, e3) ; }
private VarExprList transformVarExprList(VarExprList varExprList) { VarExprList varExprList2 = new VarExprList() ; for ( Var v : varExprList.getVars() ) { // if ( binding.contains(v)) // // Already bound. No need to do anything because the // // logical assignment will test value. // continue ; Expr expr = varExprList.getExpr(v) ; expr = expr.copySubstitute(binding) ; varExprList2.add(v, expr) ; } return varExprList2 ; }
private VarExprList transformVarExprList(VarExprList varExprList) { VarExprList varExprList2 = new VarExprList() ; for ( Var v : varExprList.getVars() ) { // if ( binding.contains(v)) // // Already bound. No need to do anything because the // // logical assignment will test value. // continue ; Expr expr = varExprList.getExpr(v) ; expr = expr.copySubstitute(binding) ; varExprList2.add(v, expr) ; } return varExprList2 ; }
@Override public Expr copySubstitute(Binding binding, boolean foldConstants) { ExprList newArgs = new ExprList() ; for ( int i = 1 ; i <= numArgs() ; i++ ) { Expr e = getArg(i) ; e = e.copySubstitute(binding, foldConstants) ; newArgs.add(e) ; } return copy(newArgs) ; }
@Override public Expr copySubstitute(Binding binding, boolean foldConstants) { ExprList newArgs = new ExprList() ; for ( int i = 1 ; i <= numArgs() ; i++ ) { Expr e = getArg(i) ; e = e.copySubstitute(binding, foldConstants) ; newArgs.add(e) ; } return copy(newArgs) ; }
@Override final public Expr copySubstitute(Binding binding, boolean foldConstants) { Expr e = (expr == null ? null : expr.copySubstitute(binding, foldConstants)) ; if ( foldConstants) { try { if ( e != null && e.isConstant() ) return eval(e.getConstant(), new FunctionEnvBase()) ; } catch (ExprEvalException ex) { /* Drop through */ } } return copy(e) ; }
@Override final public Expr copySubstitute(Binding binding, boolean foldConstants) { Expr e = (expr == null ? null : expr.copySubstitute(binding, foldConstants)) ; if ( foldConstants) { try { if ( e != null && e.isConstant() ) return eval(e.getConstant(), new FunctionEnvBase()) ; } catch (ExprEvalException ex) { /* Drop through */ } } return copy(e) ; }
if ( actionCopySubstitute ) Expr e = expr.copySubstitute(BindingFactory.create(), true) ; System.out.println(e) ;
if ( actionCopySubstitute ) Expr e = expr.copySubstitute(new BindingMap(), true) ; System.out.println(e) ;