%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}%
---++How to obtain all graphs Example
1. Using SPARQL Query: The most popular way for obtaining all graphs list, presuming every graph contains at least one triple for some rdf:type of some subject, is to execute the following query:
SQL> SPARQL
SELECT DISTINCT ?g
WHERE
{
GRAPH ?g {?s a ?t}
}
1. Using Virtuoso built-in function:: Another solution is to use the Virtuoso [[http://docs.openlinksw.com/virtuoso/fn_sparql_select_known_graphs.html][DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS]] function:
SQL> DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS();
GRAPH_IRI
VARCHAR
_______________________________________________________________________________
http://www.openlinksw.com/schemas/virtrdf#
http://localhost:8890/DAV
http://localhost:8890/dataspace
http://localhost:8890/dataspace/inf
4 Rows. -- 14 msec.
---+++Related
* [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]
* [[http://docs.openlinksw.com/virtuoso/rdfperformancetuning.html#rdfperfgetallgraphs][Virtuoso Documentation]]