SELECT ?g ?x WHERE { SELECT ?x ?g WHERE { GRAPH ?g { ?x ?p ?o . } BIND( ?o AS ?var0 ) } }