query-db347a968d8a20f490a9f8b3cdcb80ab

rq turtle/ttl

Number of films by year and genreThere is already an example querry:

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
#Number of films by year and genre
#defaultView:ScatterChart
SELECT ?year (COUNT(?_genre) AS ?count) (SAMPLE(?_genreLabel) AS ?label) (?year AS ?year_shown) WHERE {
  ?item wdt:P31 wd:Q11424.
  ?item wdt:P577 ?_publication_date.
  ?item wdt:P136 ?_genre.
  ?_genre rdfs:label ?_genreLabel.
  BIND(STR(YEAR(?_publication_date)) AS ?year)
  FILTER((LANG(?_genreLabel)) = "en")
  FILTER(?_publication_date >= "2000-00-00T00:00:00Z"^^xsd:dateTime)
}
GROUP BY ?_genreLabel ?year
HAVING (?count > 30)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?_genre"):::projected v3("?_genreLabel"):::projected v2("?_publication_date") v7("?count") v4("?item") v7("?label") v6("?year"):::projected v8("?year_shown") c5(["wd:Q11424"]):::iri f0[["?count > '30^^xsd:integer'"]] f0 --> v7 f1[["?_publication_date >= '2000-00-00T00:00:00Z^^xsd:dateTime'"]] f1 --> v2 f2[["?_genreLabel = 'en'"]] f2 --> v3 v4 --"wdt:P31"--> c5 v4 --"wdt:P577"--> v2 v4 --"wdt:P136"--> v5 v5 --"rdfs:label"--> v3 bind3[/"str(year-from-dateTime(?_publication_date))"/] v2 --o bind3 bind3 --as--o v6 bind6[/"count(?_genre)"/] v5 --o bind6 bind6 --as--o v7 bind7[/"sample(?_genreLabel)"/] v3 --o bind7 bind7 --as--o v7 bind8[/"?year"/] v6 --o bind8 bind8 --as--o v8