@Override public Expr transform(ExprVar exprVar) { //If variable matches replace with the chosen expression if (this.replacements.containsKey(exprVar.getVarName())) return this.replacements.get(exprVar.getVarName()); //Otherwise leave as is return super.transform(exprVar); }
@Override public Expr transform(ExprFunction2 func, Expr expr1, Expr expr2) { if (expr1 == null) { return new E_Null(); } if (expr2 == null) { return new E_Null(); } if (expr1 instanceof E_Null) { return expr2; } if (expr2 instanceof E_Null) { return expr1; } // can happen if filter condition contains mathematical operators // like (?x < (?y + 300) && ?x > (?y - 300)): // Jena would return (?x && ?x) // so this filter condition isn't added to the atomic query if (expr1.equals(expr2)) { return new E_Null(); } return super.transform(func, expr1, expr2); }
@Override public Expr transform(ExprFunctionOp funcOp, ExprList args, Op opArg) { Op opArg2 = Transformer.transform(transform, opArg) ; if ( opArg2 == opArg ) return super.transform(funcOp, args, opArg) ; if ( funcOp instanceof E_Exists ) return new E_Exists(opArg2) ; if ( funcOp instanceof E_NotExists ) return new E_NotExists(opArg2) ; throw new ARQInternalErrorException("Unrecognized ExprFunctionOp: \n"+funcOp) ; } }
@Override public Expr transform(ExprFunctionOp funcOp, ExprList args, Op opArg) { Op opArg2 = Transformer.transform(transform, opArg, beforeVisitor, afterVisitor) ; if ( opArg2 == opArg ) return super.transform(funcOp, args, opArg) ; if ( funcOp instanceof E_Exists ) return new E_Exists(opArg2) ; if ( funcOp instanceof E_NotExists ) return new E_NotExists(opArg2) ; throw new ARQInternalErrorException("Unrecognized ExprFunctionOp: \n"+funcOp) ; } }
return uFunc.getActualExpr(); } else { return super.transform(func, args);