query-f0ea985e7baac7f5303267d488cbf654
This should show most things that are located in Hungary and needs an image. SELECT ?item ?itemLabel ?coord WHERE { ?item wdt:P131* wd:Q28 . # Without * 21 results (1st level below Hungary), with star 8780 results (complete tree below Hungary) FILTER NOT EXISTS { ?item wdt:P18 [] } . # Filter things in the tree that don't have image OPTIONAL { ?item wdt:P625 ?coord } . # Get the coordinates if available SERVICE wikibase:label { bd:serviceParam wikibase:language "hu,en" } }
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#>
# This should show most things that are located in Hungary and needs an image.
SELECT ?item ?itemLabel ?coord
WHERE
{
?item wdt:P131* wd:Q28 . # Without * 21 results (1st level below Hungary), with star 8780 results (complete tree below Hungary)
FILTER NOT EXISTS { ?item wdt:P18 [] } . # Filter things in the tree that don't have image
OPTIONAL { ?item wdt:P625 ?coord } . # Get the coordinates if available
SERVICE wikibase:label { bd:serviceParam wikibase:language "hu,en" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?coord"):::projected
v1("?item"):::projected
a1((" "))
c3(["wd:Q28"]):::iri
c6(["bd:serviceParam"]):::iri
c8(["hu,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P18"--> e0a1
e0v1("?item"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
v1 --"wdt:P18"--> a1
v1 --"wdt:P131"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P625".-> v2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end