query-4f85f856039f230c1eb0101824b32e16
but this kept timing out, even without DISTINCT. I ran both halves of the union and both worked really fast, so I changed the query to the following:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel WHERE {
{
?item (wdt:P31/wdt:P279*) wd:Q3914.
?item wdt:P17 wd:Q218.
}
UNION
{
?item (wdt:P31/wdt:P279*) wd:Q3914.
?item wdt:P131+ wd:Q218.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "ro". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
a1((" "))
a2((" "))
c8(["bd:serviceParam"]):::iri
c5(["wd:Q218"]):::iri
c3(["wd:Q3914"]):::iri
c10(["ro"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c3
v1 --"wdt:P131"--> c5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v1 --"wdt:P17"--> c5
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end