query-01125a6236d1e1d40d76c11c63bf4d15

rq turtle/ttl

Clash between COUNT and SERVICE wikibase:label ?Is it possible to combine wthe COUNT function with the SERVICE wikibase:label function? I feel like it must be, but I've not managed to find the solution!

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?author1 ?author2 ?author1Label ?author2Label (COUNT(?work) AS ?count) WHERE {
    # Find co-authors
    ?work wdt:P50 wd:Q38382414, ?author1, ?author2 .
    # Exclude self-links
    FILTER (?author1 != ?author2)
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,de,ru,es,zh,jp". }
}
  GROUP BY ?author1 ?author2
  ORDER BY DESC(?count)
  LIMIT 1000

Query found at