query-0c6db74e5261911a1a472550b503d664
better version of the one above SELECT $item ?instance_author_count $string_author_count ?author_name ?rank WHERE { # FILTER (?count >= 7) FILTER (?string_author_count = 1) FILTER (?instance_author_count = 1) FILTER (STR(?rank) = "2") { SELECT DISTINCT ?item (COUNT (?author) as ?string_author_count) WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . ?item wdt:P2093 ?author. } GROUP BY (?item) } { SELECT DISTINCT ?item (COUNT (?instance_author) as ?instance_author_count) WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . OPTIONAL { ?item wdt:P50 ?instance_author. } } GROUP BY (?item) } { SELECT DISTINCT ?item (xsd:string(?author) AS ?author_name) ?rank WHERE { ?item wdt:P31 wd:Q13442814 ; wdt:P179 wd:Q57081850 . ?item p:P2093 [ ps:P2093 ?author ; pq:P1545 ?rank ] . } } }
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
# better version of the one above
SELECT $item ?instance_author_count $string_author_count ?author_name ?rank WHERE {
# FILTER (?count >= 7)
FILTER (?string_author_count = 1)
FILTER (?instance_author_count = 1)
FILTER (STR(?rank) = "2")
{
SELECT DISTINCT ?item (COUNT (?author) as ?string_author_count) WHERE {
?item wdt:P31 wd:Q13442814 ;
wdt:P179 wd:Q57081850 .
?item wdt:P2093 ?author.
}
GROUP BY (?item)
}
{
SELECT DISTINCT ?item (COUNT (?instance_author) as ?instance_author_count) WHERE {
?item wdt:P31 wd:Q13442814 ;
wdt:P179 wd:Q57081850 .
OPTIONAL { ?item wdt:P50 ?instance_author. }
}
GROUP BY (?item)
}
{
SELECT DISTINCT ?item (xsd:string(?author) AS ?author_name) ?rank WHERE {
?item wdt:P31 wd:Q13442814 ;
wdt:P179 wd:Q57081850 .
?item p:P2093 [
ps:P2093 ?author ;
pq:P1545 ?rank
] .
}
}
}