query-7e68bff722a571da053c63f72e37ef67

rq turtle/ttl

Ghanaian scientists by citation count SELECT ?number_of_citing_works ?author ?authorLabel ?organization ?organizationLabel ?example_work ?example_workLabel WITH { SELECT DISTINCT ?author WHERE { ?author wdt:P27| wdt:P1416/wdt:P17 | wdt:P108/wdt:P17 wd:Q117 . } } AS %authors WITH { SELECT ?author (COUNT(DISTINCT ?citing_work) AS ?number_of_citing_works) (SAMPLE(?organization_) AS ?organization) (SAMPLE(?work) AS ?example_work) WHERE { INCLUDE %authors ?work wdt:P50 ?author . OPTIONAL { ?citing_work wdt:P2860 ?work . } OPTIONAL { ?author wdt:P1416 | wdt:P108 ?organization_ . ?organization_ wdt:P17 wd:Q43 } } GROUP BY ?author } AS %results WHERE { INCLUDE %results service wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY DESC(?number_of_citing_works)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Ghanaian scientists by citation count
SELECT
  ?number_of_citing_works
  ?author ?authorLabel
  ?organization ?organizationLabel
  ?example_work ?example_workLabel
WHERE {
   {
  SELECT
    ?author 
    (COUNT(DISTINCT ?citing_work) AS ?number_of_citing_works)
    (SAMPLE(?organization_) AS ?organization)
    (SAMPLE(?work) AS ?example_work)
  WHERE {
     {
  SELECT DISTINCT ?author WHERE {
    ?author wdt:P27| wdt:P1416/wdt:P17 | wdt:P108/wdt:P17 wd:Q117 .
  }
}    ?work wdt:P50 ?author .
    OPTIONAL { ?citing_work wdt:P2860 ?work . }
    OPTIONAL {
      ?author wdt:P1416 | wdt:P108 ?organization_ .
      ?organization_ wdt:P17 wd:Q43
    }
  }
  GROUP BY ?author 
}  service wikibase:label { bd:serviceParam wikibase:language "en" . } 
}
ORDER BY DESC(?number_of_citing_works)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?author"):::projected v4("?citing_work") v7("?example_work"):::projected v6("?number_of_citing_works"):::projected v6("?organization"):::projected v5("?organization_") v3("?work") a1((" ")) a2((" ")) c10(["bd:serviceParam"]):::iri c2(["wd:Q117"]):::iri c12(["en"]):::literal c8(["wd:Q43"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P108"--> a2 a2 --"wdt:P17"--> c2 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P1416"--> a1 a1 --"wdt:P17"--> c2 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P27"--> c2 end union0r <== or ==> union0l end v3 --"wdt:P50"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P2860".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v2 -."wdt:P108".-> v5 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P1416"--> v5 end union2r <== or ==> union2l end v5 --"wdt:P17"--> c8 end bind3[/"count(?citing_work)"/] v4 --o bind3 bind3 --as--o v6 bind4[/"sample(?organization_)"/] v5 --o bind4 bind4 --as--o v6 bind5[/"sample(?work)"/] v3 --o bind5 bind5 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end