select distinct ?g where{ graph ?g { ?s ?p ?o. } }
See graph names in triple store - SPARQL
原文:http://www.cnblogs.com/RuiYan/p/4104824.html