reteplayground
Aggregate

Provinces with both victims and graves

ProvinceVictimsGraves
Lleida @es10,498446
València @es1,616366
Tarragona @es11,005307
Barcelona @es22,555201
Run this query → no server · no download · no account
caviri.github.io/rete
Run this query in the playground → 20 rows · 189 ms · 128.0 KB of 9.8 MB read over HTTP range · no server, no download — the query runs in your browser.

The query

PREFIX mc: <https://w3id.org/rete/memoria/ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?province ?victims ?graves WHERE { { SELECT ?p (COUNT(?v) AS ?victims) WHERE { ?v mc:bornInProvince ?p } GROUP BY ?p } { SELECT ?p (COUNT(?g) AS ?graves) WHERE { ?g mc:province ?p } GROUP BY ?p } ?p rdfs:label ?province . } ORDER BY DESC(?graves) LIMIT 20

rete playground · documentation · github.com/caviri/rete