SELECT (COUNT(?o) AS ?s) WHERE { ?s ?p ?o } GROUP BY ?s