Hi,
this is one of those queries people want to do: SELECT DISTINCT ?g WHERE {
GRAPH ?g { ?s ?p ?o } } (see recent thread on jena-users).
It isn't unreasonable: people want to know what are the graphs in an RDF
dataset, but as for SELECT DISTINCT ?p WHERE {?s ?p ?o.} or SELECT DISTINCT
?cls WEHRE {?i a ?cls.}, I do not see what we could
possibly do to speed things up. It's a scan of the entire index and therefore
expensive, even more so if the index do not fit into RAM.
However, if there was an easy way to see all the triples/quads added/removed,
those would be very easy to compute and fast to return... however, one need to
spot the query and have the optimizer use a
different index for those queries. I also imagine that once you start going
doing this path, more and more 'useful' queries will appear => more and more
indexes => more and more slowdown at write time.
Paolo