TrackerSparqlStatement should rebuild SQL on graph changes
Starting with the sparql1.1 support, we now generate SQL that is slightly dependent on the currently attached databases (which we use for graph support). What happens then is that if graphs are created or dropped, older SQL generated before the change may be rendered less optimal, or result in query errors.
This is usually not a problem, except in TrackerSparqlStatement, as its business is precisely caching the SPARQL->SQL translation.
TrackerDataManager internally keeps the accounting of such graph changes, it should be possible to make built statements check themselves before execution, and transparently trigger the re-generation of the SQL if necessary.