query-860180bdd620393cb08cae3476408ddf

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# count of games published in ROM format per platform per year, 1995-1997
#defaultView:BarChart
SELECT DISTINCT
?platformLabel
(COUNT(*) AS ?game_count) (STR(?pubYear_) AS ?pubYear) # turn back pubYear_ YEAR into STR for the bar chart x-axis to look good
WHERE { 
  ?game wdt:P31 wd:Q7889. # instance of video game
  ?game wdt:P437 wd:Q633454. # distribution format is ROM cartridge
  ?game wdt:P577 ?pubDate.
  ?game wdt:P400 ?platform.

  BIND (YEAR(?pubDate) AS ?pubYear_) # cast pubDate as YEAR for filtering

  FILTER (?pubYear_ >= 1995 && ?pubYear_ <= 1997)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?pubYear_ ?platformLabel
ORDER BY ASC(?platformLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?game") v6("?game_count") v5("?platform") v1("?platformLabel"):::projected v4("?pubDate") v7("?pubYear") v6("?pubYear_"):::projected c10(["bd:serviceParam"]):::iri c6(["wd:Q633454"]):::iri c4(["wd:Q7889"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?pubYear_ >= '1995^^xsd:integer'?pubYear_ <= '1997^^xsd:integer'"]] f0 --> v6 v3 --"wdt:P31"--> c4 v3 --"wdt:P437"--> c6 v3 --"wdt:P577"--> v4 v3 --"wdt:P400"--> v5 bind1[/"year-from-dateTime(?pubDate)"/] v4 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind3[/"count(*)"/] bind3 --as--o v6 bind4[/"str(?pubYear_)"/] v6 --o bind4 bind4 --as--o v7