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/wikiproject_author-awards.sparql
Wikiproject aspect: author awards
PREFIX hint: <http://www.bigdata.com/queryHints#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX target: <http://www.wikidata.org/entity/Q60687720>
SELECT ?count
?award ?awardLabel (CONCAT("/award/", SUBSTR(STR(?award), 32)) AS ?awardUrl)
?recipients ?recipientsUrl
WITH {
SELECT (COUNT(?researcher) AS ?count) ?award
(GROUP_CONCAT(DISTINCT ?researcher_label; separator=", ") AS ?recipients)
(CONCAT("../authors/", GROUP_CONCAT(DISTINCT SUBSTR(STR(?researcher), 32); separator=",")) AS ?recipientsUrl)
WHERE {
{
SELECT DISTINCT ?researcher ?award WHERE {
hint:Query hint:optimizer "None" .
{ ?work wdt:P6104 target: .}
union
{ ?work wdt:P5008 target: .}
?work wdt:P50 ?researcher .
?researcher wdt:P166 ?award .
}
LIMIT 100
}
?researcher rdfs:label ?researcher_label . FILTER (LANG(?researcher_label) = 'en')
}
GROUP BY ?award
} AS %result
WHERE {
INCLUDE %result
?award rdfs:label ?awardLabel . FILTER (LANG(?awardLabel) = 'en')
}
GROUP BY ?count ?award ?awardLabel ?recipients ?recipientsUrl
ORDER BY DESC(?count)
graph TD