query-a3a810f09f6b2057de0f268285c31509

rq turtle/ttl

Battles per year per continent and country last 80 years (animated) Battles per year per continent and country last 80 years (animated) Batailles par année, continent et pays durant ces 80 dernières années (avec animation) Battles per year per continent and country last 80 years (animated) Battles per year per continent and country last 80 years (animated) Oorlogen per jaar per continent en land de afgelopen 80 jaar (animatie) Slag per år per kontinent och land de senaste 80 åren (animerat) Battles per year per continent and country last 80 years (animated) Battles per year per continent and country last 80 years (animated) Battles per year per continent and country last 80 years (animated)

Use at

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 bd: <http://www.bigdata.com/rdf#>
#defaultView:BarChart
SELECT (SAMPLE(?_continentLabel) AS ?continent) (COUNT(?_country) AS ?battles) (SAMPLE(?_countryLabel) AS ?_countryLabel) (SAMPLE(?year) AS ?year)  WHERE {
  ?subj wdt:P31 wd:Q178561.        # instance of battle
  OPTIONAL { ?subj wdt:P580 ?d1. } # start date
  OPTIONAL { ?subj wdt:P585 ?d2. } # point in time
  OPTIONAL { ?subj wdt:P582 ?d3. } # end date
  BIND(IF(!BOUND(?d1), IF(!BOUND(?d2), ?d3, ?d2), ?d1) AS ?date)
  BIND(str(YEAR(?date)) AS ?year)
  FILTER(BOUND(?year))
  ?subj wdt:P276/wdt:P17 ?_country.
  ?_country wdt:P30 ?_continent.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
       ?_country rdfs:label ?_countryLabel.
       ?_continent rdfs:label ?_continentLabel.}
  BIND((NOW()) - ?date AS ?distance)
  FILTER((0 <= ?distance) && (?distance < 31 * 12 * 80))
}
GROUP BY ?year ?_country

Query found at