query-dcf95b4bd4476170a2b752f7c46e1b40

rq turtle/ttl

(Q403)Serbia

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#>
SELECT ?item ?itemLabel ?administrative_entity ?administrative_entityLabel ?administrative_entity_country ?administrative_entity_countryLabel
WHERE
{
  VALUES ?country { wd:Q403 }
  ?item wdt:P17 ?country .
  OPTIONAL { ?item wdt:P576 ?dissolved . }
  FILTER (! BOUND(?dissolved))
  ?item wdt:P131 ?administrative_entity .
  MINUS
  {
    ?administrative_entity wdt:P17 ?country .
  }
  OPTIONAL { ?administrative_entity wdt:P17 ?administrative_entity_country . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?administrative_entity"):::projected v5("?administrative_entity_country"):::projected v2("?country") v1("?dissolved") v3("?item"):::projected c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not bound(?dissolved)"]] f0 --> v1 bind1[/VALUES ?country/] bind1-->v2 bind10(["wd:Q403"]) bind10 --> bind1 v3 --"wdt:P17"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P576".-> v1 end v3 --"wdt:P131"--> v4 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P17"--> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P17".-> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end