query-fd40a3de4f2ced05a886545b61e117b5

rq turtle/ttl

title: Employees and affiliated with a specified organization

PREFIX target: http://www.wikidata.org/entity/Q24283660

SELECT (SAMPLE(?number_of_works_) AS ?works) ?researcher ?researcherLabel (CONCAT("#author/", SUBSTR(STR(?researcher), 32)) AS ?researcherUrl) ?researcherDescription WITH { SELECT DISTINCT ?researcher WHERE { ?researcher ( wdt:P108| wdt:P463 | wdt:P1416 ) / wdt:P361* target: . } } AS %researchers WITH { SELECT (COUNT(?work) AS ?number_of_works_) ?researcher WHERE { INCLUDE %researchers

# No biological pathways; they skew the statistics too much 
MINUS { ?work wdt:P31 wd:Q4915012 }

# This OPTIONAL query should be after the MINUS query, otherwise
# researchers might not show if they do not have any papers.
OPTIONAL { ?work wdt:P50 ?researcher . }

} GROUP BY ?researcher } AS %researchers_and_number_of_works WHERE { INCLUDE %researchers_and_number_of_works SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,nl,no,ru,sv,zh" . } } GROUP BY ?researcher ?researcherLabel ?researcherDescription ORDER BY DESC(?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#>
# title: Employees and affiliated with a specified organization

PREFIX target: <http://www.wikidata.org/entity/Q24283660>

SELECT
  (SAMPLE(?number_of_works_) AS ?works)
  ?researcher ?researcherLabel
  (CONCAT("#author/", SUBSTR(STR(?researcher), 32)) AS ?researcherUrl)
  ?researcherDescription
WHERE {
   {
  SELECT
    (COUNT(?work) AS ?number_of_works_) ?researcher
  WHERE {
     {
  SELECT DISTINCT ?researcher WHERE {
    ?researcher ( wdt:P108| wdt:P463 | wdt:P1416 ) / wdt:P361* target: .
  } 
}
    # No biological pathways; they skew the statistics too much 
    MINUS { ?work wdt:P31 wd:Q4915012 } 

    # This OPTIONAL query should be after the MINUS query, otherwise
    # researchers might not show if they do not have any papers.
    OPTIONAL { ?work wdt:P50 ?researcher . }
  } 
  GROUP BY ?researcher
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,nl,no,ru,sv,zh" . } 
}
GROUP BY ?researcher ?researcherLabel ?researcherDescription 
ORDER BY DESC(?works)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?number_of_works_"):::projected v2("?researcher"):::projected v5("?researcherUrl") v3("?work") v5("?works") a1((" ")) c10(["bd:serviceParam"]):::iri c7(["wd:Q4915012"]):::iri c5(["wd:Q24283660"]):::iri c12(["en,da,de,es,fr,nl,no,ru,sv,zh"]):::literal 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:P1416"--> a1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P463"--> a1 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P108"--> a1 end union0r <== or ==> union0l end a1 --"wdt:P361"--> c5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v3 --"wdt:P31"--> c7 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P50".-> v2 end bind2[/"count(?work)"/] v3 --o bind2 bind2 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind4[/"sample(?number_of_works_)"/] v4 --o bind4 bind4 --as--o v5 bind5[/"concat('#author/',substring(str(?researcher),'32^^xsd:integer'))"/] v2 --o bind5 bind5 --as--o v5