query-b7cab29b8a212ae5468989ba7fe4a91c
Find prolific authors i.e. authors who are listed as the author of many books SELECT DISTINCT ?authorLabel ?birthDate ?deathDate ?nationalityLabel ?bookCount WHERE { SELECT ?author ?authorLabel ?birthDate ?deathDate ?nationalityLabel (COUNT(?book) AS ?bookCount) WHERE { # expand Q571 to include sub-classes of books for more results # but this will mostly increase query time ?book wdt:P31 wd:Q571; wdt:P50 ?author. OPTIONAL { ?author wdt:P569 ?birthDate. } OPTIONAL { ?author wdt:P570 ?deathDate. } OPTIONAL { ?author wdt:P27 ?nationality. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". ?book rdfs:label ?bookLabel. ?author rdfs:label ?authorLabel. ?nationality rdfs:label ?nationalityLabel. } } GROUP BY ?author ?authorLabel ?birthDate ?deathDate ?nationalityLabel } ORDER BY DESC (?bookCount)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Find prolific authors i.e. authors who are listed as the author of many books
SELECT DISTINCT ?authorLabel ?birthDate ?deathDate ?nationalityLabel ?bookCount WHERE {
SELECT ?author ?authorLabel ?birthDate ?deathDate ?nationalityLabel (COUNT(?book) AS ?bookCount) WHERE {
# expand Q571 to include sub-classes of books for more results
# but this will mostly increase query time
?book wdt:P31 wd:Q571;
wdt:P50 ?author.
OPTIONAL { ?author wdt:P569 ?birthDate. }
OPTIONAL { ?author wdt:P570 ?deathDate. }
OPTIONAL { ?author wdt:P27 ?nationality. }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?book rdfs:label ?bookLabel.
?author rdfs:label ?authorLabel.
?nationality rdfs:label ?nationalityLabel.
}
}
GROUP BY ?author ?authorLabel ?birthDate ?deathDate ?nationalityLabel
}
ORDER BY DESC (?bookCount)