prefix mon: # http://jena.apache.org/documentation/query/group-by.html SELECT ?C (count(?Cty) AS ?CT) FROM WHERE { ?C a mon:Country ; (mon:hasCity|(mon:hasProvince/mon:hasCity)) ?Cty } GROUP BY ?C HAVING (count(?Cty) > 1)