Re: ISSUE-20: SPARQL Update: Empty vs non-existent graphs

On Wed, Dec 23, 2009 at 6:33 AM, Andy Seaborne <andy.seaborne@talis.com> wrote:
> ISSUE-20
>
> Pulled out because this interacts with query (1.0).
>
>> ISSUE-20: Difference between an empty graph and a non-existent graph?
>> We have agreed on the need to support a graph that exists and is
>> empty. Is there anything else to consider for this issue? Does it have
>> an impact on the Update document? By coming to this agreement, then I
>> think we*don't*  need to worry about it in Update. We'd only have to
>> consider it if we disallowed empty graphs.
>>
>> I've left ISSUE-20 in, but if people agree that it's resolved, then
>> I'll take it out.
>
> My preference is that empty graphs and absent graphs are treated
> differently.  This is based on seeing users expectations of systems I'm
> involved in.

This is my preference also.

In Mulgara, we explicitly manage graphs, rather than allow them to be
de facto formed through the insertion of a quad with a new graph URI.
It is certainly possible to detect and record new graph URIs, though
detecting the last use of a graph URI in a deleted quad could have
some potential overhead.

> It does make store writing harder and some of mine don't support this
> because they can only test for the presence or absence of quads.  There is
> no separate graph management.  No quads does not mean no graph, if empty
> graphs can exist.
>
> It can show up in query in
>   SELECT * { GRAPH ?g {...} }

Just to be clear, we expect:

  SELECT ?g { GRAPH ?g { ?s ?p ?o } }

to only return graphs with something in them, right? I suppose this
means there's no standard way to query for the existence of an empty
graph.

> Some related issues in update are about adding triples into an empty graph
> vs a non-existent graph (does it automatically get created?)

I'd rather not. If this is needed then it can be done with:
  CREATE SILENT <uri>
  INSERT DATA { GRAPH <uri> { triples } }

> whether CREATE
> on an existing (empty of otherwise) graph is an error and DROPping a graph
> not in the store.

We have already been operating on the assumption that creating an
existing graph or dropping a non-existent graph can lead to an error,
through the inclusion of SILENT in those commands.

Regards,
Paul

Received on Thursday, 7 January 2010 21:07:22 UTC