It might be because of a wrong understanding of how selects with subqueries work, but I encounter the following problem. The following query should provide all the labels of a sub list of items (having occupation mathematician) limited by an explicit limit:
SELECT ?item ?label
WHERE {
?item rdfs:label ?labelNode .
{
SELECT ?item
WHERE
{ ?item wdt:P106 wd:Q170790. }
LIMIT 3
}
BIND(STR(?labelNode) AS ?label).
}
I had understood from w3.org that the subquery should be evaluated first, providing 3 items to the outer scope, where then all labels will be retrieve. The inner query does indeed its job in 1 second. But the full query leads to time out. Is it a problem in wikidata? do I wrongly understand the concept of subquery?