query-a4c84891106d5e6bd21ba653c9a9b314

rq turtle/ttl

Calculating ratiosI'm looking to calculate (and ideally visualise) the ratio of anon:non-anon reviewers for each journal in the WikiJournal user group. I've managed to get the counts (below), but I'm looking for the ratio for each journal.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?reviewer ?reviewerLabel (COUNT(?article) AS ?count) WHERE {
  # Fetch data
  ?WikiJournal wdt:P123 wd:Q28953974 .         # journals in WJ user group
  ?article wdt:P1433 ?WikiJournal.             # articles in journal
  ?article p:P4032 [ps:P4032 ?reviewer].       # reviewers for each article

  # Fetch lables
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}
}
GROUP BY ?reviewer ?reviewerLabel
ORDER BY DESC (?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?WikiJournal") v3("?article"):::projected v5("?count") v4("?reviewer"):::projected a1((" ")) c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q28953974"]):::iri v2 --"p:direct/P123"--> c2 v3 --"p:direct/P1433"--> v2 a1 --"p:statement/P4032"--> v4 v3 --"p:P4032"--> a1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind1[/"count(?article)"/] v3 --o bind1 bind1 --as--o v5