I am trying to extract all items of a category on Wikidata, with their respective page title in English. It works ok as long as the category does not contain many items, like this:
SELECT ?work ?workLabel
WHERE
{
?work wdt:P31/wdt:P279* wd:Q734454.
?work rdfs:label ?workLabel .
FILTER ( LANGMATCHES ( LANG ( ?workLabel ), "en" ) )
}
ORDER BY ?work
but times out (Query timeout limit reached )as soon as I use a category with more items, such as Q2188189
. See This example
I have tried using LIMIT
or OFFSET
clauses but this does not change the result.
I also have tried to insert a filter like this FILTER (regex(?work, '.*Q1.*')) .
to slice the query in subsets, also without success (No matching records found).
For now I have only extracted the ids - and then run queries to get the page title for each one of them, but that seems silly.
Is there a way to work around the timeout?