Make the default graph have a name
SPARQL doesn't really like things missing an IRI where they could have an IRI, this is a reason for blank nodes being as awkward as they are, and in our case, some of this awkwardness also surfaces in the case of our anonymous graph, specially as our default graph also joins all named graphs:
SELECT *
{
# This pulls from all graphs
?a a rdfs:Resource
GRAPH ?g {
# This pulls from named graphs only
?b a rdfs:Resource
}
}
The default graph being anonymous, it becomes impossible to isolate (e.g. query only from it), the most close being:
SELECT *
{
?s ?p ?o .
MINUS { GRAPH ?g { ?s ?p ?o } } .
}
Which is almost, but not quite the same as querying the anonymous graph alone, and also quite expensive.
What this branch does is:
- Adding a bunch of tests to guarantee behavior.
- Makes the anonymous graph get a
nrl:DefaultGraph
name. - Improves/fixes the support of FROM/FROM NAMED (and USING/USING NAMED in updates) so it is more up-to-spec and applies in every place it should.
- Reimplements our traditional behavior to keep the default graph anonymous as a default set of FROM/FROM NAMED.
- Adds a bunch more tests that would previously break in a way or another.
This makes everything work as before, but with the ability to bring the default graph as a named graph, and reference it specifically, e.g.:
SELECT *
FROM nrl:DefaultGraph
{
# This queries nrl:DefaultGraph only, excluding all other graphs
?s ?p ?o .
}