A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/organization_employees-and-affiliated.sparql
Organization aspect: Employees and affiliated with a specified organization
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
# title: Employees and affiliated with a specified organization
PREFIX target: <http://www.wikidata.org/entity/Q104785223>
SELECT
(SAMPLE(?number_of_works_) AS ?works)
(SAMPLE(?wikis_) AS ?wikis)
?researcher ?researcherLabel ?researcherDescription
(SAMPLE(?orcid_) AS ?orcid)
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
OPTIONAL { ?researcher wdt:P496 ?orcid_ . }
OPTIONAL { ?researcher wikibase:sitelinks ?wikis_ }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
GROUP BY ?researcher ?researcherLabel ?researcherDescription
ORDER BY DESC(?works)
graph TD