@Test public void testKeepBindWithFilter() { TupleExpr expr = new SPARQLParser().parseQuery("SELECT ?x\nWHERE {BIND (\"x\" AS ?x) FILTER (?x = \"x\")}", "http: TupleExpr clone = expr.clone(); new HalyardFilterOptimizer().optimize(clone, null, null); assertEquals(expr, clone); }
@Override public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { tupleExpr.visit(new FilterOptimizer.FilterFinder(tupleExpr) { @Override public void meet(Filter filter) { super.meet(filter); filter.visit(new FilterOptimizer.FilterRelocator(filter) { { filterVars.retainAll(filter.getArg().getBindingNames()); } }); } }); }
HalyardFilterOptimizer extends FilterOptimizer { @Override public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { tupleExpr.visit(new FilterOptimizer.FilterFinder(tupleExpr) { @Override public void meet(Filter filter) { super.meet(filter); filter.visit(new FilterOptimizer.FilterRelocator(filter) { { filterVars.retainAll(filter.getArg().getBindingNames()); } }); } }); } }
HalyardFilterOptimizer extends FilterOptimizer { @Override public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { tupleExpr.visit(new FilterOptimizer.FilterFinder(tupleExpr) { @Override public void meet(Filter filter) { super.meet(filter); filter.visit(new FilterOptimizer.FilterRelocator(filter) { { filterVars.retainAll(filter.getArg().getBindingNames()); } }); } }); }  }
HalyardFilterOptimizer extends FilterOptimizer { @Override public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { tupleExpr.visit(new FilterOptimizer.FilterFinder(tupleExpr) { @Override public void meet(Filter filter) { super.meet(filter); filter.visit(new FilterOptimizer.FilterRelocator(filter) { { filterVars.retainAll(filter.getArg().getBindingNames()); } }); } }); }  @Override void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings); }
HalyardFilterOptimizer extends FilterOptimizer { @Override public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { tupleExpr.visit(new FilterOptimizer.FilterFinder(tupleExpr) { @Override public void meet(Filter filter) { super.meet(filter); filter.visit(new FilterOptimizer.FilterRelocator(filter) { { filterVars.retainAll(filter.getArg().getBindingNames()); } }); } }); }  @Override void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings);  }