I'm new to querying DBPedia. How can I find first 10 countries that has highest number of women who won Nobel award from http://dbpedia.org/sparql
Asked
Active
Viewed 82 times
-2
-
This will be quite a complex query. Please show your attempts – Tomasz Pluskiewicz Feb 16 '16 at 08:33
-
2Have you browsed any of the questions tagged with [tag:dbpedia] and [tag:sparql] here on Stack Overflow? There are lots of examples. On Stack Overflow, it's better to show what you've attempted, and to describe precisely what you're looking for, so that you can get detailed answers. As written, this question is too broad and doesn't *show* any research effort or attempts (regardless of what you might have already done). – Joshua Taylor Feb 16 '16 at 13:05
1 Answers
0
Try this -
SELECT DISTINCT ?origin (COUNT(?origin) AS ?count) WHERE {
?w dbo:birthPlace ?origin .
?w dct:subject <http://dbpedia.org/resource/Category:Women_Nobel_laureates> .
}
GROUP BY ?origin
ORDER BY DESC (?count)
LIMIT 10

Anthony Hughes
- 576
- 3
- 12
-
1This isn't a legal SPARQL query. You can check with [sparql.org's query validator](http://sparql.org/validate/query), which reports, "Non-group key variable in SELECT: ?origin". To make this legal, you'd need at add `group by ?origin`. – Joshua Taylor Feb 16 '16 at 13:07
-
Most likely a typo - just add 'GROUP BY ?origin' to the end of the query and it works fine. – scotthenninger Feb 17 '16 at 03:22
-
I was testing directly through the http://dbpedia.org/sparql endpoint - didn't throw any issues. – Anthony Hughes Feb 17 '16 at 09:18
-
The GROUP BY clause is necessary to create the aggregate (COUNT). Not sure why you did not receive the error about the non-group variable. – scotthenninger Feb 17 '16 at 15:25