User:PAC2/Législatives

From Wikidata
Jump to navigation Jump to search
SELECT ?item ?itemLabel ?circo ?circoLabel (COUNT(*) AS ?sitelinks)  WHERE {
  ?item wdt:P31 wd:Q5;
     p:P3602 ?statement.
  ?statement ps:P3602  wd:Q106253677.
  OPTIONAL { ?statement pq:P768 ?circo. }
  ?sitelink schema:about ?item.
  FILTER (SUBSTR(str(?sitelink), 11, 15) = ".wikipedia.org/") .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
}
GROUP BY ?item ?itemLabel ?circo ?circoLabel 
ORDER BY DESC (?count)
LIMIT 100
Try it!
#title: List of candidates by constituency
 SELECT ?item ?itemLabel ?constituency ?constituencyLabel WHERE {
  ?item wdt:P31 wd:Q5;
     p:P3602 ?statement.
  ?statement ps:P3602  wd:Q106253677.
  OPTIONAL { ?statement pq:P768 ?constituency. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?item ?itemLabel ?constituency ?constituencyLabel 
ORDER BY DESC (?constituencyLabel)
List of candidates by constituency
#title: List of candidates by constituency
 SELECT ?item ?itemLabel ?constituency ?constituencyLabel ?party ?partyLabel ?votes WHERE {
  ?item wdt:P31 wd:Q5;
     p:P3602 ?statement.
  ?statement ps:P3602  wd:Q106253677.
  OPTIONAL { ?statement pq:P768 ?constituency. }
  OPTIONAL { ?statement pq:P1268 ?party. }
  OPTIONAL { ?statement pq:P1111 ?votes. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC (?constituencyLabel)
List of candidates by constituency