@Test public void testPropagateFilterMoreAgresivelly() { final TupleExpr expr = new SPARQLParser().parseQuery("select * where {?a ?b ?c, ?d. filter (?d = ?nonexistent)}", "http: new HalyardFilterOptimizer().optimize(expr, null, null); expr.visit(new AbstractQueryModelVisitor<RuntimeException>(){ @Override public void meet(Join node) throws RuntimeException { assertEquals(expr.toString(), "Filter", node.getRightArg().getSignature()); super.meet(node); } @Override public void meet(Filter node) throws RuntimeException { assertEquals(expr.toString(), "StatementPattern", node.getArg().getSignature()); } }); }
@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);  }