query-c9a9104d48c777b442757342843cd984
Alle Nationalrate nach Kanton und Amtszeit
SELECT DISTINCT ?item ?itemLabel ?cantonLabel ?start_time
SELECT DISTINCT ?item (COUNT(?start_time) AS ?nr_times)
(GROUP_CONCAT(year(?start_time); separator=";") AS ?start_times)
(GROUP_CONCAT(?cantonLabel; separator=";") AS ?cantons)
(GROUP_CONCAT(?periodLabel; separator=";") AS ?periods)
WHERE
{
?item wdt:P39 wd:Q18510612 .
?item p:P39 ?statement .
FILTER EXISTS {?statement ?v wd:Q18510612 . }
OPTIONAL { ?statement pq:P768 ?canton . } OPTIONAL { ?statement pq:P580 ?start_time . } OPTIONAL { ?statement pq:P2937 ?period . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de". ?canton rdfs:label ?cantonLabel . ?period rdfs:label ?periodLabel . } } GROUP BY ?item
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Alle Nationalrate nach Kanton und Amtszeit
# SELECT DISTINCT ?item ?itemLabel ?cantonLabel ?start_time
SELECT DISTINCT ?item (COUNT(?start_time) AS ?nr_times)
(GROUP_CONCAT(year(?start_time); separator=";") AS ?start_times)
(GROUP_CONCAT(?cantonLabel; separator=";") AS ?cantons)
(GROUP_CONCAT(?periodLabel; separator=";") AS ?periods)
WHERE
{
?item wdt:P39 wd:Q18510612 .
?item p:P39 ?statement .
FILTER EXISTS {?statement ?v wd:Q18510612 . }
OPTIONAL { ?statement pq:P768 ?canton . }
OPTIONAL { ?statement pq:P580 ?start_time . }
OPTIONAL { ?statement pq:P2937 ?period . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de".
?canton rdfs:label ?cantonLabel .
?period rdfs:label ?periodLabel .
}
}
GROUP BY ?item