Specify graphs wherever possible: Tracker SPARQL Library Reference Manual

## Specify graphs wherever possible

Queries on the union graph, or with unrestricted graphs, for example:

    1
    2
    SELECT ?u { ?u a rdfs:Resource }
    SELECT ?g ?u { GRAPH ?g { ?u a rdfs:Resource }}

Will traverse across all graphs. Query complexity will increment linearly with the amount of graphs. Production code should rarely need to introspect graphs, and should strive to being aware of the graph(s) involved. The fastest case is accessing one graph.

The graph(s) may be specified through `WITH/FROM/FROM NAMED/GRAPH` and other SPARQL syntax for graphs. For example:

    1
    2
    WITH <G> SELECT ?u { ?u a rdfs:Resource }
    WITH <G> SELECT ?g ?u { GRAPH ?g { ?u a rdfs:Resource }}