query-01910fdc141726c1b9ad1ab6932e724e
Number of books by year and genre Number of books by year and genre Nombre de livres par genre et par année Number of books by year and genre Number of books by year and genre Aantal boeken per jaar en genre Antalet böcker efter år och genre Number of books by year and genre Number of books by year and genre Number of books by year and genre
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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:LineChart
SELECT ?year (COUNT(?_genre) AS ?count ) (SAMPLE(?_genreLabel) AS ?genreLabel ) WHERE {
?item wdt:P31 wd:Q571;
wdt:P577 ?_publication_date;
wdt:P136 ?_genre.
BIND(str(YEAR(?_publication_date)) AS ?year)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?_genre rdfs:label ?genreLabel.}
FILTER (?_publication_date >= "2000-00-00T00:00:00Z"^^xsd:dateTime)
}
GROUP BY ?_genreLabel ?year
HAVING (?count > 10)
Query found at
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?_genre"):::projected
v7("?_genreLabel"):::projected
v2("?_publication_date")
v8("?count")
v8("?genreLabel")
v3("?item")
v5("?year"):::projected
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c4(["wd:Q571"]):::iri
f0[["?count > '10^^xsd:integer'"]]
f0 --> v8
f1[["?_publication_date >= '2000-00-00T00:00:00Z^^xsd:dateTime'"]]
f1 --> v2
v3 --"wdt:P31"--> c4
v3 --"wdt:P577"--> v2
v3 --"wdt:P136"--> v4
bind2[/"str(year-from-dateTime(?_publication_date))"/]
v2 --o bind2
bind2 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
v4 --"rdfs:label"--> v8
end
bind5[/"count(?_genre)"/]
v4 --o bind5
bind5 --as--o v8
bind6[/"sample(?_genreLabel)"/]
v7 --o bind6
bind6 --as--o v8