query-9e0e83754815187414ae60fc0080fb8d

rq turtle/ttl

description checker for gminas SELECT DISTINCT ?item ?itemLabel ?itemDescription ?gminaLabel ?wojLabel WHERE { # get instance of any gmina wiejska, miejsko-wiejska {?item wdt:P31 wd:Q3504085 .} UNION { ?item wdt:P31 wd:Q3491915 . } ?item wdt:P31 ?gmina . ?item wdt:P131 ?powiat . ?powiat wdt:P131 ?woj . # from Poland ?item wdt:P131* wd:Q36 . # where instance of has no end time MINUS { ?item p:P31 [ pq:P580 ?end_time ] } . SERVICE wikibase:label { bd:serviceParam wikibase:language "pl". } } ORDER BY ?itemLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# description checker for gminas
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?gminaLabel ?wojLabel WHERE {
  # get instance of any gmina wiejska, miejsko-wiejska
  {?item wdt:P31 wd:Q3504085 .} UNION { ?item wdt:P31 wd:Q3491915 . }
  ?item wdt:P31 ?gmina .
  ?item wdt:P131 ?powiat . ?powiat wdt:P131 ?woj .
  # from Poland
  ?item wdt:P131* wd:Q36 .
  # where instance of has no end time
  MINUS { ?item p:P31 [ pq:P580 ?end_time ] } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pl". }
}
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?end_time") v3("?gmina") v2("?item"):::projected v1("?itemLabel"):::projected v4("?powiat") v5("?woj") a1((" ")) c3(["wd:Q3491915"]):::iri c9(["bd:serviceParam"]):::iri c11(["pl"]):::literal c2(["wd:Q3504085"]):::iri c5(["wd:Q36"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c2 end union0r <== or ==> union0l end v2 --"p:direct/P31"--> v3 v2 --"p:direct/P131"--> v4 v4 --"p:direct/P131"--> v5 v2 --"p:direct/P131"--> c5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; a1 --"p:qualifier/P580"--> v6 v2 --"p:P31"--> a1 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end