query-5312a61060b49b70cfcdd9c972f49cc8
, por lo que es bastante sencillo: ORDER BY (en este caso, <code?count) en una cláusula SELECTCasi terminamos con la consulta -Sólo nos queda una mejora: nos gustaría visualizar los materiales más utilizados primero. Por fortuna, se nos permite utilizar aquí las nuevas funciones agregación de la cláusula
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 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(?pintura) AS ?count)
WHERE
{
  ?pintura wdt:P31/wdt:P279* wd:Q3305213;
            p:P186 [ ps:P186 ?material; pq:P518 wd:Q861259 ].
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
GROUP BY ?material ?materialLabel
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?count")
  v3("?material"):::projected 
  v2("?pintura"):::projected 
  a1((" "))
  a2((" "))
  c3(["wd:Q3305213"]):::iri 
  c9(["bd:serviceParam"]):::iri 
  c11(["#91;AUTO_LANGUAGE#93;"]):::literal 
  c6(["wd:Q861259"]):::iri 
  v2 --"p:direct/P31"-->  a1
  a1 --"p:direct/P279"-->  c3
  a2 --"p:statement/P186"-->  v3
  a2 --"p:qualifier/P518"-->  c6
  v2 --"p:P186"-->  a2
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c9 --"wikibase:language"-->  c11
  end
  bind1[/"count(?pintura)"/]
  v2 --o bind1
  bind1 --as--o v4