query-ae8ffd9bf232a9c736ceff6287e10fa4
P31/wdt:P279 wd:Q16917 in wdt:P131/wdt:P131 wd:Q25 (query optimization) } . Q25:wd P131:wdt/P131:wdt ?item . Q145:wd P17:wdt ; Q16917:wd P279:wdt/P31:wdt ?item { WHERE * SELECT Which query hint do I need to use to get this to work? The first part has about 30000 items, the second part 40000. Limiting the first part to UK cuts it down to 1500. 13:02, 17 June 2019 (UTC) JuraIt seems a trivial query, but maybe it's because it's Monday. --- : One method is to split it into two queries that run only once each, then combine the result.Jura1@ Пересечение двух запросов
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT *
WHERE {
{
SELECT ?item WHERE {
?item wdt:P31/wdt:P279* wd:Q16917 ; wdt:P17 wd:Q145 .
}
}.
{
SELECT ?item WHERE {
?item wdt:P131/wdt:P131* wd:Q25 .
}
}.
}
Query found at
- https://www.wikidata.org/wiki/User:Infovarius/Queries
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2019/06
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
a1((" "))
a2((" "))
c3(["wd:Q16917"]):::iri
c5(["wd:Q145"]):::iri
c7(["wd:Q25"]):::iri
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v1 --"wdt:P17"--> c5
v1 --"wdt:P131"--> a2
a2 --"wdt:P131"--> c7