What I want:
If you have 2 triples in GraphDB as:
<ex:s_1> <ex:p_1> <ex:o_1> .
<ex:s_1> <ex:p_1> <ex:o_1> <ex:g_1> .
How can I delete only the one in the default graph with a DELETE DATA query?
I am trying to do this in a query that may also be deleting many other triples/quads from named graphs at the same time. I'd prefer not to use FROM DEFAULT
or FROM <http://rdf4j.org/schema/rdf4j#nil>
because then I have to include all the FROM NAMED <xxx>
that I would need as well which could be a lot, though I can do that if that is the only way.
What I did:
The GraphDB documentation says that the URI http://rdf4j.org/schema/rdf4j#nil represents the default graph and it works and gives YES correctly when used in an ASK query. That seems promising. This seems to work correctly (well, the way I'd like it to):
ASK
WHERE {
GRAPH <http://rdf4j.org/schema/rdf4j#nil> {
<ex:s_1> <ex:p_2> <ex:o_3> .
}
}
So I tried to use it in my DELETE DATA query as:
DELETE DATA {
GRAPH <http://rdf4j.org/schema/rdf4j#nil> {
<ex:s_1> <ex:p_2> <ex:o_3> .
}
};
But this does not delete it. No error, but no delete either. So it seems to only have limited usefulness, you get an error when trying to use that in an INSERT. I haven't found this level of specifics in the documentation as to what works or what doesn't.
And this, deletes both:
DELETE DATA {
<ex:s_1> <ex:p_2> <ex:o_3> .
};