query-23f776d0ae6cd69836437d01441f9404

rq turtle/ttl

GitHub users who co-authored scholarly publications

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#>
# tool: scholia
#defaultView:Graph
SELECT ?author1 ?author1Label ?rgb ?author2 ?author2Label
WHERE {
   {
  # Limit the number of coauthors
  SELECT DISTINCT ?author2 ?author1  (COUNT(?work) AS ?count2)  WHERE {
     {
  # Limit the number of authors
  SELECT (COUNT(?work) AS ?count1) ?author1 ?work WHERE {
    ?work wdt:P50 ?author1 .
    ?author1 wdt:P2037 ?githubuser1 .
  }
  GROUP BY ?author1 ?work
  ORDER BY DESC(?count1)
  LIMIT 10000
}    ?work wdt:P50 ?author1 , ?author2 .
    ?author2 wdt:P2037 ?githubuser2 .
    FILTER (?author1 != ?author2) 
  }
  GROUP BY ?author2 ?author1 
  ORDER BY DESC(?count2)
  LIMIT 10000
}  OPTIONAL { ?author1 wdt:P21 ?gender1 . }
  BIND( IF(?gender1 = wd:Q6581097, "3182BD", "E6550D") AS ?rgb)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en,fr,de,ru,es,zh,jp".
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?author1"):::projected v3("?author2"):::projected v7("?count1") v8("?count2") v8("?gender1") v6("?githubuser1") v7("?githubuser2") v9("?rgb"):::projected v5("?work") c7(["en,fr,de,ru,es,zh,jp"]):::literal c5(["bd:serviceParam"]):::iri f0[["?author1 != ?author2"]] f0 --> v2 f0 --> v3 v5 --"wdt:P50"--> v2 v2 --"wdt:P2037"--> v6 bind2[/"count(?work)"/] v5 --o bind2 bind2 --as--o v7 v5 --"wdt:P50"--> v2 v5 --"wdt:P50"--> v3 v3 --"wdt:P2037"--> v7 bind4[/"count(?work)"/] v5 --o bind4 bind4 --as--o v8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P21".-> v8 end bind5[/"if(?gender1 = 'wd:Q6581097','3182BD','E6550D')"/] v8 --o bind5 bind5 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end