query-c64053b6a46b13ae95040647fcd783ed

rq turtle/ttl

Awards and research prices: Number of person entries and wikipedia articlesHi there, I have written a SPARQL that gives me all awards (Q618779) and research prizes (Q11448906) and counts the number of person entries per award/prize and the number of wikipedia articles. However, as far as I can see, my final list has only awards/research prizes with at least one person with an entry of having received these awards (P166). https://w.wiki/72p7 11:52, 13 July 2023 (UTC)) talk (RichirikkenHas someone an idea, of how to correct this? I would like to have also awards/prices with no person entries in the list. Best regards and thanks in advance! 13:54, 16 July 2023 (UTC)) talk (Vincent Tep https://w.wiki/747n - but I can't get it to work and I don't know if I'm going in the right direction: thisI'm not sure why you would be interested in awards that have no recipients (which would be quite strange - would such awards even be notable enough to warrant a Wikidata item?), but I've tried to write a query that does the opposite, starting from all existing awards and then finding their recipients, drawing inspiration from an "awards received" property. If someone has not received any award, they won't have this property at all since it would have no statements. So you're doing your GROUP BY on a list of people with at least 1 award.who haveI think this is because you start from people ,RichirikkenHello @05:05, 17 July 2023 (UTC)) talk (RichirikkenBest regards, -- You are right in pointing out the reason for my "error", but I cannot find the solution. I'll try to work with your script. Hovewer, if someone can help I would be very happy. Thanks, that is already helpful. We want to have a base list of all awards. If an award has no winner in the wikidata, it just means that the wikidata entries are incomplete, I think. Hello Vincent,I managed t write a SPARQL that gives mit all awards and research prices and counting the number of wikipedia articles.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item (COUNT(DISTINCT ?article) as ?wiki_article_count)   WHERE {
  { ?item p:P31 ?statement0.
    ?statement0 (ps:P31) wd:Q618779.}
  UNION
  {?item p:P31 ?statement1.
    ?statement1 (ps:P31) wd:Q11448906.}
           OPTIONAL {
          ?article schema:about ?item .
       } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY  ?item

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?article"):::projected v1("?item"):::projected v2("?statement0") v3("?statement1") v5("?wiki_article_count") c3(["wd:Q618779"]):::iri c7(["bd:serviceParam"]):::iri c4(["wd:Q11448906"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"p:P31"--> v3 v3 --"p:statement/P31"--> c4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:P31"--> v2 v2 --"p:statement/P31"--> c3 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."schema:about".-> v1 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind1[/"count(?article)"/] v4 --o bind1 bind1 --as--o v5