RDFLib/rdflib — pull request #401 by bcogrel (2014-06-12 20:30:05+00:00)
Title: SPARQLStore.contexts() should find empty named graphs when possible

This feature is needed for graph-awareness (#399).

The current implementation of SPARQLStore.contexts() only finds non-empty named graphs.
This patch makes it less restrictive.

However, something the SPARQL endpoint backend does not find empty named graphs (e.g. TDB) with the proposed query. Is there another solution?

It also resets the query before writing its own. This prevents the query to fail because of a previous query that used a `default-graph-uri` parameter.