W3C home > Mailing lists > Public > semantic-web@w3.org > January 2008

Re: N3 and Turtle Syntax Questions

From: Hugh Glaser <hg@ecs.soton.ac.uk>
Date: Tue, 15 Jan 2008 19:08:48 +0000
To: Tim Berners-Lee <timbl@w3.org>
CC: SW-forum Web <semantic-web@w3.org>
Message-ID: <C3B2B540.18061%hg@ecs.soton.ac.uk>

Sounds good.
Any advice on proposing a change to turtle?
[Specifically to add (',')? to Rule 8.]
Email to public-cwm-talk, cc Dave Beckett?
But I would guess that most of the people are on this list as well.


On 10/1/08 02:25, "Tim Berners-Lee" <timbl@w3.org> wrote:

> Oh, I completely understand why -- that's indeed why N3 has it.
<SW irrelevant>
> (I have sed files for generating N3 -- very practical. Don't tell anyone.)
Ah sed, thou good and faithful servant, inherited from the previous occupant
of the house.
He talks funny, and moves a bit slowly compared to the young lads, but
listens carefully to what I want and does what I ask.
> Mind you, I have always been generating pred-object pairs,
> so I have used the ability to end in a semicolon, not a comma.
>
> Tim
>
> PS: IIRC  Pascal and Algol has the same problem. See
> e.g.http://www.lysator.liu.se/c/bwk-on-pascal.html "Pascal, in common with
> most other Algol-inspired languages, uses the semicolon as a statement
> separator rather than a terminator". Just because I shave it off doesn't mean
> it ain't grey ;-)  Ee bah gum, when I were a lad, were would be lucky to even
> *have* semicolons, ... ;-)
Sorry, mate, not quite grey enough.
That line across the top of the Pascal syntax diagram meant empty statements
were possible (as you have in N3).
So as brw says in the excellent article you refer to (thanks): "Fortunately,
in Pascal one can almost always close one's eyes and get away with a
semicolon as a terminator." True also of N3.

But then are we being fair? Comparing turtle statements with programming
language statements? Surely it should be with structure initialisation?
And of course we find that brw got it right in C:
struct x z = {1,2,3,};
Is fine.

And I'll risk a IIRC without looking it up. I guess in 68 you could get a
similar effect by stuffing a "void" at the end of any list of instructions
you were generating. Thus every Serial Clause would end in void, which would
be coerced to whatever type was needed. Don't know why I didn't think of
that at the time, or maybe I did.
Yes, bah gum, those were the days when when you could get a "goto x" to
undergo a procedure coercion to proc void.
<Muses on silently in the same vein for a few minutes />
</SW irrelevant>
Hugh
>
> On 2008-01 -09, at 14:33, Hugh Glaser wrote:
>
>>
>> This was going to be a quick confirmation on N3 and turtle syntax for ';'
>> and ',', but seems to have got a bit complicated.
>>
>> I want to write
>>
>> @prefix owl:  <http://www.w3.org/2002/07/owl#> .
>> <http://southampton.rkbexplorer.com/id/person-00021>
>> owl:sameAs <http://citeseer.rkbexplorer.com/id/resource-CSP109020> ;
>> owl:sameAs
>> <http://dblp.rkbexplorer.com/id/people-1726e6ee8fb20c8704f47285949b39b3-d101
>> 32da488b7179a8b1844f88470032> ;
>> .
>>
>> Similarily:
>> @prefix owl:  <http://www.w3.org/2002/07/owl#> .
>> <http://southampton.rkbexplorer.com/id/person-00021> owl:sameAs
>> <http://citeseer.rkbexplorer.com/id/resource-CSP109020> ,
>> <http://dblp.rkbexplorer.com/id/people-1726e6ee8fb20c8704f47285949b39b3-d101
>> 32da488b7179a8b1844f88470032> ,
>> .
>>
>> That is:
>> <#pat> <#age> 24;  <#eyecolor> "blue"; .
>> and
>> <#pat> <#child> [ <#age> 4 ], [ <#age> 3 ], .
>>
>> Looking at the syntagmata in (1) and (2), my reading is that I can do this
>> for ';', although they have different structures:
>> N3 seems to do it by the possibility of () for propertylist.
>> Turtle seems to have an explicit optional ';' (in rule 7).
>>
>> On the other hand, for ',':
>> N3 seems to do it by the possibility of () for objecttail.
>> However, I don't think I can do the same in turtle, as rule 8 in (2) lacks
>> the extra (',')?
>>
>> (I would have downloaded the yacc grammar for N3 and tried it for real, but
>> the link on (3) to the yacc grammar gives 404, by the way.)
>>
>> So the question is: have I got something wrong?
>> If not, then to use the second, ',', construct, I need to use N3, not
>> turtle.
>> So some questions are:
>> Is this what is intended, rather than an omission?
>> If so, why?
>> It seems a bit strange that such simple N3 is not compatible with turtle.
>>
>> (1) http://www.w3.org/2000/10/swap/grammar/n3.n3
>> (2) http://www.dajobe.org/2004/01/turtle/#sec-tutorial
>> (3) http://www.w3.org/DesignIssues/Notation3.html
>>
>> PS
>> And if you want to know why, it is because I want to generate a load of
>> sameAs triples. It is a common problem for program (and other) generators
>> not to want to know you are generating the last item in a list, and simply
>> treat the ';' or ',' as terminator, rather than separator. This can be
>> achieved by allowing null productions (as N3 above), or an explicit optional
>> (as turtle ';'), or by actually making it a terminator, although then you
>> tend to end up with ';;;' in the code.
>> And you can't put it at the front of each output either, otherwise you need
>> to treat the first item in the list specially.
>> (For the grey beards among us, this is why generating something like Algol68
>> was more of a pain than generating Pascal!)
>>
>> Best
>> Hugh
Received on Tuesday, 15 January 2008 19:09:39 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 21:45:20 GMT