SELECT ?s ( STR( ?v ) AS ?w ) WHERE { ?s ?p ?o . } GROUP BY ?s VALUES ?v { "1"^^ }