SELECT * WHERE { { SELECT ?s ?v WHERE { ?s ?p ?o } GROUP BY ?s VALUES ?v { 1 } } }