Shruts_me
Shruts_me

Reputation: 893

sparql query sparql.query().convert() sometime throw exception while give output on Virtuoso SPARQL Query Editor

I am running sparql query

    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

    SELECT DISTINCT(?film_link) ?film_name ?wikipage
    WHERE {
    ?film_link rdf:type <http://dbpedia.org/ontology/Film> .
    ?film_link foaf:name ?film_name .
    ?film_link foaf:page ?wikipage .

    } LIMIT 10000 OFFSET  num

This query is running in for loop [0,9999,19999,29999,39999,49999]
sometimes results = sparql.query().convert() throws an exceptions.
Some give results and some don't. While all queries are returning data when I ran these queries on Virtuoso SPARQL Query Editor... does any one have idea?

Upvotes: 2

Views: 455

Answers (1)

jimkont
jimkont

Reputation: 923

The problem is with Distinct.

When using Distinct query shortcut / optimization is limited and if you have many results your query could timeout (depending on server load)

You may look into this DBpedia thread for other alternatives / optimizations http://sourceforge.net/mailarchive/message.php?msg_id=28653250

Also, distinct requires more server resources. Depending on the query it may have to evaluate all the results - even though you ask for a limit - and that could result in query timeouts (depending on current server load). I am not sure if this is the case for your query...

Upvotes: 1

Related Questions