new QueryModelPruner().optimize(query, bindings);
new QueryJoinOptimizer(statistics).optimize(query, bindings);
new FederationFilterOptimizer().optimize(query, bindings);
statistics.await(); // let statistics throw any exceptions it has
new PrepareOwnedTupleExpr(federation.getMetaData()).optimize(query, bindings);
logger.trace("Optimized query model:\n{}", query);
return query;
}