query-c74b32857b541cc8b815e232ab542655

rq turtle/ttl

Publications per year

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:BarChart
PREFIX target: <http://www.wikidata.org/entity/Q18618629>

SELECT
  (STR(?year_) AS ?year)
  (COUNT(?work) AS ?works)
  ?roleLabel
WHERE {
  {
    ?work wdt:P50 target: .
    BIND("author" AS ?role)
  }
  UNION
  {
    ?work wdt:P98 target: .
    BIND("editor" AS ?role)
  }


  ?work wdt:P577 ?publication_datetime .

  BIND(YEAR(?publication_datetime) AS ?year_)
  FILTER (!STRSTARTS(STR(?publication_datetime), "http://www.wikidata.org/.well-known/genid/"))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?year_ ?roleLabel
ORDER BY ?year

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?publication_datetime") v5("?role") v3("?work"):::projected v6("?works") v6("?year") v5("?year_"):::projected c7(["bd:serviceParam"]):::iri c3([http://www.wikidata.org/entity/Q18618629]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not starts-with(str(?publication_datetime),'http://www.wikidata.org/.well-known/genid/')"]] f0 --> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P98"--> c3 bind1[/"'editor'"/] bind1 --as--o v5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P50"--> c3 bind2[/"'author'"/] bind2 --as--o v5 end union0r <== or ==> union0l end v3 --"wdt:P577"--> v2 bind3[/"year-from-dateTime(?publication_datetime)"/] v2 --o bind3 bind3 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind5[/"str(?year_)"/] v5 --o bind5 bind5 --as--o v6 bind6[/"count(?work)"/] v3 --o bind6 bind6 --as--o v6