query-50ff926493a39de177185934808710bb

rq turtle/ttl

Bad aggregate (even though we know that can’t happen), and so it complains that you’re not specifying an aggregate function for that variable. ?materials per ?materialLabel“Bad aggregate” is an error message you’ll probably see a lot when working with group queries; it means that one of the selected variables needs an aggregate function but doesn’t have one, or it has an aggregate function but isn’t supposed to have one. In this case, WDQS thinks that there might be multiple . ?materialLabel and ?material clause, there’s one result for each combination of those variables, and you can select all those variables without aggregate function. In this case, we’ll group over both GROUP BYOne solution is to group over multiple variables. If you list multiple variables in the

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?material ?materialLabel (COUNT(?malarstwo) AS ?count)
WHERE
{
  ?malarstwo wdt:P31/wdt:P279* wd:Q3305213;
            p:P186 [ ps:P186 ?materiał; pq:P518 wd:Q861259 ].
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
GROUP BY ?material ?materialLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?count") v1("?malarstwo"):::projected v2("?materiał") a1((" ")) a2((" ")) c3(["wd:Q3305213"]):::iri c9(["bd:serviceParam"]):::iri c11(["#91;AUTO_LANGUAGE#93;"]):::literal c6(["wd:Q861259"]):::iri v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 a2 --"p:statement/P186"--> v2 a2 --"p:qualifier/P518"--> c6 v1 --"p:P186"--> a2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind1[/"count(?malarstwo)"/] v1 --o bind1 bind1 --as--o v3