W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2009

Re: ISSUE-48: Less verbose delete syntax

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Fri, 06 Nov 2009 19:29:46 +0000
Message-ID: <4AF4792A.3050807@talis.com>
To: Steve Harris <steve.harris@garlik.com>
CC: public-rdf-dawg@w3.org


On 06/11/2009 17:55, Steve Harris wrote:
> On 6 Nov 2009, at 10:26, Andy Seaborne wrote:
>> Consider:
>>
>> DELETE { ?x :p ?o }
>> DELETE { ?x :p ?o } WHERE { ?x :p o . FILTER(?o = <doesnotexist> }
>>
>> which might arise from either using DELETE for INSERT by mistake the
>> second time or other bad editting
>
> I don't quite follow this example.

The point is made better below.  It shows that it's easy to make 
mistakes - the accidently change to two operations, rather than one, 
results in a less constrained DELETE with potentially dangerous effects.

   rm -rf *.rdf
and
   rm -rf * .rdf

are rather different.

>
>> Assuming the INSERT is optional as well, which I think is the intent,
>> we have to be a bit careful about creating traps for the unwary:
>>
>> And DELETE without WHERE is potentially ambiguous as a grammar and
>> certainly optically:
>>
>> DELETE
>> INSERT
>> WHERE
>>
>> Is that one request
>> DELETE-INSERT-WHERE
>> or two
>> DELETE
>> INSERT-WHERE
>
> I think we agreed that there would be some separator (from memory ';')
> to avoid that kind of problem, though I don't think we discussed the
> DELETE { ... } syntax explicitly.

Isn't this going to lead to potentially easy mistakes to make?  Omitting 
the ";" isn't necessarily a syntax error - it's a different but valid 
set of requests.

Like queries, the whole DELETE-INSERT-WHERE operation is often multiline 
so using small details like an odd ";" are easy to miss.  And we alreayd 
have {} for some grouping.

On 06/11/2009 17:55, Steve Harris wrote:

>
>> What about missing the template out instead:
>>
>> DELETE WHERE {?x :p ?o }
>
> If we're going to support this kind of syntax abbreviation, then this
> looks better to me.

I'm warming to it.  Messy grammar for all the cases that can and can't 
be written, but that's a do-once thing and I think it makes for good 
readability.

>
> I've had several bad experiences with SQL and typing:
> DELETE FROM table<enter>
> when I was just thinking what I would type next and pressed enter
> reflexively. I'm happy to chalk it up to incompetence on my part, but I
> think we can do better than SQL in this area.

Yes - it's a bit too easy. I've done the "rm -rf *" thing as well :-(

	Andy

>
> - Steve
>
>> 2009/11/6 Kjetil Kjernsmo <kjetil@kjernsmo.net>:
>>> On Friday 6. November 2009 02:30:37 Axel Polleres wrote:
>>>> We didn't consider this particularly,
>>>
>>> OK!
>>>
>>>> but having the
>>>> WHERE part optional for a DELETE in that sense you propose
>>>> doesn't seem problematic to me, at first sight.
>>>
>>> Yeah, it breaks the earlier assumption that all variables needs to be
>>> bound
>>> in the WHERE clause, but since the value in this case will not be
>>> returned,
>>> it will simply be deleted, I think it looks like a nice way to resolve
>>> ISSUE-48.
>>>
>>> Cheers,
>>>
>>> Kjetil
>>> --
>>> Kjetil Kjernsmo
>>> kjetil@kjernsmo.net
>>> http://www.kjetil.kjernsmo.net/
>>>
>>>
>>> ______________________________________________________________________
>>> This email has been scanned by the MessageLabs Email Security System.
>>> For more information please visit http://www.messagelabs.com/email
>>> ______________________________________________________________________
>>>
>>
>
Received on Friday, 6 November 2009 19:30:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:40 GMT