query-2f952b50ac4a87a68469bb6d82af4488
Distribution of alma mater of elected members by legislatureHello! I'm trying to build a graph of the alma maters of elected members at the Basque parliament by legislature. Something in my code is not correct, but don't know how to show it.
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT (count(?uni) as ?count) (sample(?uniLabel) as ?label) (year(?start) as ?year) WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P39 wd:Q28778415.
  ?item p:P39 ?elect.
  ?elect ps:P39 ?elect_ .
  ?elect pq:P2937 ?term .
  ?term wdt:P31 wd:Q106450751.
             ?term wdt:P580 ?start.
  ?item wdt:P69 ?uni.
}
GROUP by ?uniLabel ?start
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v8("?count")
  v2("?elect")
  v3("?elect_")
  v1("?item")
  v9("?label")
  v5("?start"):::projected 
  v4("?term")
  v6("?uni"):::projected 
  v7("?uniLabel"):::projected 
  v10("?year")
  c6(["wd:Q28778415"]):::iri 
  c11(["wd:Q106450751"]):::iri 
  c2(["bd:serviceParam"]):::iri 
  c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal 
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c2 --"wikibase:language"-->  c4
  end
  v1 --"p:direct/P39"-->  c6
  v1 --"p:P39"-->  v2
  v2 --"p:statement/P39"-->  v3
  v2 --"p:qualifier/P2937"-->  v4
  v4 --"p:direct/P31"-->  c11
  v4 --"p:direct/P580"-->  v5
  v1 --"p:direct/P69"-->  v6
  bind2[/"count(?uni)"/]
  v6 --o bind2
  bind2 --as--o v8
  bind3[/"sample(?uniLabel)"/]
  v7 --o bind3
  bind3 --as--o v9
  bind4[/"year-from-dateTime(?start)"/]
  v5 --o bind4
  bind4 --as--o v10