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

Re: N3 and Turtle Syntax Questions

From: Tim Berners-Lee <timbl@w3.org>
Date: Wed, 9 Jan 2008 21:25:22 -0500
Cc: SW-forum Web <semantic-web@w3.org>
Message-Id: <43DFA84D-CAB9-464F-B66F-EBDB2F1FC3B9@w3.org>
To: Hugh Glaser <hg@ecs.soton.ac.uk>
Oh, I completely understand why -- that's indeed why N3 has it.
(I have sed files for generating N3 -- very practical. Don't tell  
anyone.)
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, ... ;-)

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
> -- 
> Hugh Glaser,  Reader
>               Dependable Systems & Software Engineering
>               School of Electronics and Computer Science,
>               University of Southampton,
>               Southampton SO17 1BJ
> Work: +44 (0)23 8059 3670, Fax: +44 (0)23 8059 3045
> Mobile: +44 (0)78 9422 3822, Home: +44 (0)23 8061 5652
> http://www.ecs.soton.ac.uk/~hg/
>
>
>
Received on Thursday, 10 January 2008 02:25:40 GMT

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