query-68352be1e1ed550c7645d45c6963af6a

rq turtle/ttl

The 294 German rurals with capital

Use at

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#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?rural ?key ?ruralLabel ?classLabel ?capitalLabel ?capital WHERE {
  ?rural p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?class .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?class wdt:P279 wd:Q106658 .
  ?rural wdt:P440 ?key .
  ?rural wdt:P36 ?capital
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?capital"):::projected v5("?class") v3("?end") v2("?instanceBlock") v1("?key"):::projected v4("?rural"):::projected c5(["wd:Q106658"]):::iri c11(["de"]):::literal c9(["bd:serviceParam"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:qualifier/P582"--> e0v2 e0v2("?end"):::projected e0v1("?instanceBlock"):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> v3 v2 --"p:qualifier/P582"--> v3 v4 --"p:P31"--> v2 v2 --"p:statement/P31"--> v5 v5 --"p:direct/P279"--> c5 v4 --"p:direct/P440"--> v1 v4 --"p:direct/P36"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end