Sarven Capadisli wrote:
> SELECT DISTINCT ?g
> WHERE {
>   GRAPH ?g {
>     ?s ?p ?o .
>   }
> }

Hi Sarven,
asking for a list of the graphs in an RDF dataset is IMHO a pretty reasonable
use case and thing to do.

Your query, however, I suspect scan through all your data. This would explain
timeouts and long running times.

One suggestion is: if you are sure each graph has some specific triples and/or
properties, you could make the ?s ?p ?o triple pattern more specific and reduce
the amount of bindings/data. This might not be possible.

Another way would be to see if this pattern can be spotted by the optimizer and
do it in a better way. We could use the GSPO index (which is sorted by G, then
S, then P, then O) and apply the "reduced" operation of the SPARQL algebra which
over a sorted stream is equivalent to "distinct". I think it should work.

If others think this is a good idea, I'll go ahead, create a JIRA issue and
try to do it.

Listing the graphs in an RDF dataset seems to me quite an important and common
use case, don't you agree?

My 2 cents,
Paolo


Reply via email to