Re: ISSUE-48: Less verbose delete syntax

On 6 Nov 2009, at 19:29, Andy Seaborne wrote:
>
> 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.

Ah, I understand now. I hadn't understood that you were proposing it  
could be read as a single statement. That would be addressed with the  
use of ; though, I think.

>>> 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.

I think the ; is intended to be mandatory between operations.

> 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.

Yes, but not grouping between operations.

> 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 think so too, but I've not given it a huge amount of thought. I'd  
have to look at the corner cases I think before I was convinced.

>> 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 :-(

- 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
>>>> ______________________________________________________________________
>>>>
>>>
>>

-- 
Steve Harris, CTO, Garlik Limited
2 Sheen Road, Richmond, TW9 1AE, UK
+44(0)20 8973 2465  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10  
9AD

Received on Sunday, 8 November 2009 14:24:15 UTC