public void visit(ASTQuery ast) { rewrite(ast); }
public void visit(ASTQuery ast) { rewrite(ast); }
/** * Rewrite path as BGP * Modify exp (no copy is done) */ public Exp rewrite(Exp exp){ if (ast == null){ ast = ASTQuery.create(); } if (exp.isTriple()){ Triple t = exp.getTriple(); if (t.isPath()){ return rewrite(t, t.getRegex()); } } else if (exp.isQuery()){ rewrite(exp.getQuery().getBody()); } else for (int i=0; i<exp.size(); i++){ exp.set(i, rewrite(exp.get(i))); } return exp; }
/** * Rewrite path as BGP * Modify exp (no copy is done) */ public Exp rewrite(Exp exp){ if (ast == null){ ast = ASTQuery.create(); } if (exp.isTriple()){ Triple t = exp.getTriple(); if (t.isPath()){ return rewrite(t, t.getRegex()); } } else if (exp.isQuery()){ rewrite(exp.getQuery().getBody()); } else for (int i=0; i<exp.size(); i++){ exp.set(i, rewrite(exp.get(i))); } return exp; }
/** * Query is a SPARQL Update * rewrite the body of insert delete where */ public void rewrite(ASTUpdate update){ for (Update u : update.getUpdates()){ if (u.isComposite()){ Composite c = u.getComposite(); if (c.getBody() != null){ rewrite(c.getBody()); } } } }
/** * Query is a SPARQL Update * rewrite the body of insert delete where */ public void rewrite(ASTUpdate update){ for (Update u : update.getUpdates()){ if (u.isComposite()){ Composite c = u.getComposite(); if (c.getBody() != null){ rewrite(c.getBody()); } } } }
res = rewrite(res); return res;
res = rewrite(res); return res;