query-08810c6e930244ee7511f8a7a46d67ef

rq turtle/ttl

Alle Thurgauer Nationalrate SELECT DISTINCT ?item ?itemLabel ?cantonLabel WHERE { ?item wdt:P39 wd:Q18510612 .
?item p:P39 ?statement . ?statement pq:P768 ?canton . # get Canton for which they served and filter FILTER EXISTS {?statement pq:P768 wd:Q12713. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

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#>
# Alle Thurgauer Nationalrate
SELECT DISTINCT ?item ?itemLabel ?cantonLabel
WHERE 
{
  ?item wdt:P39 wd:Q18510612 .  
  ?item p:P39 ?statement .
  ?statement pq:P768 ?canton . # get Canton for which they served and filter
  FILTER EXISTS {?statement pq:P768 wd:Q12713.  }
  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; v3("?canton") v2("?item"):::projected v1("?statement") c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q12713"]):::iri c4(["wd:Q18510612"]):::iri f0[[" "]] subgraph f0e0["Exists Clause"] e0v1 --"p:qualifier/P768"--> e0c2 e0v1("?statement"):::projected e0c2(["wd:Q12713"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> c2 v1 --"p:qualifier/P768"--> c2 v2 --"p:direct/P39"--> c4 v2 --"p:P39"--> v1 v1 --"p:qualifier/P768"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end