User:PAC2/Elections

From Wikidata
Jump to navigation Jump to search

Timeline of general elections in a given year[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID
    #defaultView:Timeline
    #title: List of general elections in 2024
    SELECT ?item ?itemLabel ?date 
    WHERE {
      SERVICE wikibase:mwapi {
         bd:serviceParam wikibase:endpoint "en.wikipedia.org";
                         wikibase:api "Generator";
                         mwapi:generator "links";
                         mwapi:titles "List of elections in 2024";.
         ?item wikibase:apiOutputItem mwapi:item.
      } 
      FILTER BOUND (?item)
      ?item wdt:P31/wdt:P279* wd:Q40231 ; 
            wdt:P585 ?date ; 
            rdfs:label ?itemLabel filter (lang(?itemLabel) = "en") . 
    }
    ORDER BY ?date