query-461bcabf9ff4c1228567075c28d79648

rq turtle/ttl

NYU faculty queries Goal: query that returns NYU faculty with Wikidata items, then looked at the SPARQL query used to generate this list of NYU-affiliated people: NYU's Scholia pageWe started by looking at

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#>
SELECT
  (SAMPLE(?number_of_works_) AS ?works)
  (SAMPLE(?wikis_) AS ?wikis)
  ?researcher ?researcherLabel ?researcherDescription
  (SAMPLE(?orcid_) AS ?orcid)
WHERE {
   {
  SELECT
    (COUNT(?work) AS ?number_of_works_) ?researcher
  WHERE {
     {
  SELECT DISTINCT ?researcher WHERE {
    ?researcher ( wdt:P108| wdt:P463 | wdt:P1416 ) / wdt:P361* wd:Q49210 . 
  } 
}    OPTIONAL { ?work wdt:P50 ?researcher . }
  } 
  GROUP BY ?researcher
}  OPTIONAL { ?researcher wdt:P496 ?orcid_ . }
  OPTIONAL { ?researcher wikibase:sitelinks ?wikis_ }
  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 v8("?orcid") v5("?orcid_"):::projected v2("?researcher"):::projected v7("?wikis") v6("?wikis_"):::projected v3("?work") v7("?works") a1((" ")) c10(["bd:serviceParam"]):::iri c5(["wd:Q49210"]):::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 optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P50".-> v2 end bind1[/"count(?work)"/] v3 --o bind1 bind1 --as--o v4 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P496".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wikibase:sitelinks".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind5[/"sample(?number_of_works_)"/] v4 --o bind5 bind5 --as--o v7 bind6[/"sample(?wikis_)"/] v6 --o bind6 bind6 --as--o v7 bind7[/"sample(?orcid_)"/] v5 --o bind7 bind7 --as--o v8