W3C home > Mailing lists > Public > public-cwm-talk@w3.org > July to September 2004

Re: Notation for sets in n3

From: Tim Berners-Lee <timbl@w3.org>
Date: Wed, 4 Aug 2004 08:27:11 -0400
Message-Id: <9BD7191C-E611-11D8-B1F7-000A9580D8C0@w3.org>
Cc: Jos De_Roo <jos.deroo@agfa.com>, Yosi Scharf <syosi@mit.edu>, public-cwm-talk@w3.org
To: Sandro Hawke <sandro@w3.org>

>
>>
>> How about adding at least one comma to a list syntax to give set
>> syntax, so that the same punctuation is used for lists.  The comma
>> could be thought of as adding unorderedness.  (The other use of a 
>> comma
>> occurs in RDF statements with multiple objects - and the objects are 
>> of
>> course nor ordered)
>>
>>   (,)  The null set
>> (  :a  ,)  The set with  only :a in it
>> ( :a, :b, :c)  The set with :a , :b and :c in it
>
> That's rather elegant.  I'd suggest a semicolon intead of a comma,
> though, since so many list syntaxes (everything I can think of other
> than LISP and n3) use commas.   Another option is "|".    The mnemonic
> for me comes mostly from semi-colon being Prolog's "or", and a set is
> kind of vaguely a little like an alternation.  :-)


> What's the current n3 meaning of { <a>, <b> }?

That is free.

>  Is that something really useful?  I like { } for sets (since that's 
> what I learn in my
> math classes) and formulas are very similar to sets of triples.

True.  I had been thinking that formulae were too different from lists 
for sets to look like them - but then, formulae are indeed unordered 
sets of statements.

{ <a>, <b>, <c> }

works for me, as I also kinda expect {} for a set since high school.

Currently N3 is an LR1 language which can be predictively parsed: you 
know which production is being expanded by looking just at the first 
token.   This change would mess that up, in that one would have to try 
both productions to distinguish

{ <a> <b> <c> }  from  { <a> , <b>, <c> }

where <a> could be any path expression.

The inelegant but effective solution to that would be
{ , <a>, <b>, <c> }
which would be consistent with
{,}
as the null set and
{,<a>}
as a singleton set.

Tim
Received on Wednesday, 4 August 2004 08:27:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:11:01 GMT