java.lang.Object
org.eclipse.rdf4j.query.algebra.evaluation.optimizer.FilterOptimizer
All Implemented Interfaces:
QueryOptimizer
Direct Known Subclasses:
FilterOptimizer

public class FilterOptimizer extends Object implements QueryOptimizer
Optimizes a query model by pushing Filters as far down in the model tree as possible.

To make the first optimization succeed more often it splits filters which contains And conditions.

SELECT * WHERE { \t?s ?p ?o . \t?s ?p ?o2 . \tFILTER(?o > '2'^^xsd:int invalid input: '&'invalid input: '&' ?o2 invalid input: '<' '4'^^xsd:int) } May be more efficient when decomposed into: SELECT * WHERE { \t?s ?p ?o . \tFILTER(?o > '2'^^xsd:int) \t?s ?p ?o2 . \tFILTER(?o2 invalid input: '<' '4'^^xsd:int) }

Then it optimizes a query model by merging adjacent Filters. e.g. SELECT * WHERE { \t?s ?p ?o . \tFILTER(?o > 2) . \tFILTER(?o invalid input: '<' 4) . } May be merged into: SELECT * WHERE { \t?s ?p ?o . \tFILTER(?o > 2 invalid input: '&'invalid input: '&' ?o invalid input: '<' 4) . }

This optimization allows for sharing evaluation costs in the future and removes an iterator. This is done as a second step to not break the first optimization. In the case that the splitting was done but did not help it is now undone.

Author:
Arjohn Kampman, Jerven Bolleman