Whenever I run into a timeout, the first thing I do is remove the " "SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}" from the query. Often replacing that for statements with rdfs:label and schema:description, plus the equivalent language filers. I adapted you query accordingly and got results:
https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20%3F...
Cheers,
Andra
On Sat, Jun 18, 2016 at 8:22 PM, Seb35 seb35wikipedia@gmail.com wrote:
Hello, and my first post here :)
For medium-size queries which timeout in a SPARQL endpoint, you can add these clauses and it sometimes gives a result:
ORDER BY RAND() LIMIT 100
You will only obtain some results with no specific order, but it is better than nothing. It doesn’t work everytime, but it works more often than without it or with only a limit. Given it is a hacky technique, it should be the last thing to try, after other query optimisations.
For instance, when I search all elements with a GND ID (P227) without P31 neither P279, I get a timeout even when I only add a limit. When I add these two clauses, I get a result.
Cheers, ~ Seb35
With rand:
https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20%3F...
Without rand:
https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20%3F...
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata