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

Re: [TF-LIB] COALESCE is an unhelpful choice of name

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Sat, 14 Nov 2009 20:07:33 +0000
Message-ID: <4AFF0E05.9080708@talis.com>
To: Sandro Hawke <sandro@w3.org>
CC: Lee Feigenbaum <lee@thefigtrees.net>, Alexandre Passant <alexandre.passant@deri.org>, Paul Gearon <gearon@ieee.org>, SPARQL Working Group <public-rdf-dawg@w3.org>
What about TRY ?

   TRY(xsd:integer(?x), 0)

 > What happens if all the terms are unbound?  An error?

I think it has to be an error and XXX(expression) without a default 
value is a no-op.

	Andy


On 14/11/2009 15:51, Sandro Hawke wrote:
>> Then again, that's what COALESCE means also, so this is a case of once I
>> think about it, none of the names make sense to me.   :)
>
> One more bit of data: Perl and Python use their "or" operator (which is
> "||" in perl) for roughly this functionality.
>
> For example:
>
>     $ perl
>     print(0 || 2);
>     2
>
>     $ python
>     Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
>     >>>  print False or 0 or 2
>     2
>
> In our case, it's not skipping over zero or false, just unbound, right?
>
> So how about FIRST_BOUND?  In Prolog terminology, it'd be either
> FIRST_GROUND or FIRST_NONVAR, since once a variable is bound, it's not
> considered a variable any more.
>
> What happens if all the terms are unbound?  An error?  In that case it
> could just be a special n-ary form of something to assert it's bound --
> leave off the 'first'.  NONVAR(x) returns its argument, unless x is an
> unbound variable.  NONVAR(x, y) is the "obvious" extension to try x,
> then y, etc.
>
>      -- Sandro
>
>
>> :)
>>
>> Lee
>>
>> Alexandre Passant wrote:
>>>
>>> On 13 Nov 2009, at 19:05, Paul Gearon wrote:
>>>
>>>> On Fri, Nov 13, 2009 at 6:59 PM, Steve Harris
>>>> <steve.harris@garlik.com>  wrote:
>>>>> On 13 Nov 2009, at 13:01, Andy Seaborne wrote:
>>>>>
>>>>>> I don't find the name COALESCE very helpful.
>>>>>>
>>>>>> None of these seem good but they are better to me:
>>>>>>
>>>>>> VAL
>>>>>> VALUE
>>>>>> FIRST
>>>>>> FIRST_VAL
>>>>>> PROTECT
>>>>>> SAFE
>>>>>
>>>>> None of these float my boat, but out of interest, what's the source
>>>>> of your
>>>>> dislike for COALESCE? I find it pretty obvious, but then I've been
>>>>> using SQL
>>>>> for too long.
>>>>
>>>> Personally, I'd never heard of this function, and it's been completely
>>>> opaque to me. I've come back to it a few times now (each time after a
>>>> break of a couple of weeks) and every time I've had to look up some
>>>> documentation to remind myself of what it meant.
>>>>
>>>> But then, I haven't used SQL much in recent years.
>>>
>>> I was in the same case, it took me a while before figuring out what that
>>> function what about.
>>> It may be obvious from people with an SQL background but it's
>>> apparently, based on the feedback here, not a relevant name for people
>>> that don't have such background.
>>>
>>> So, do we in general want to stick to SQL naming or focus on something
>>> easy to understand for people coming to SPARQL without any bg on SQL ?
>>> I'd prefer the second option and then chose a more relevant name (as
>>> MELD for instance, or synonyms as FUSE)
>>>
>>> Best,
>>>
>>> Alex.
>>>
>>>>
>>>> Regards,
>>>> Paul Gearon
>>>>
>>>
>>> --
>>> Dr. Alexandre Passant
>>> Digital Enterprise Research Institute
>>> National University of Ireland, Galway
>>> :me owl:sameAs<http://apassant.net/alex>  .
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
Received on Saturday, 14 November 2009 20:07:47 GMT

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