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

N3 and Turtle Syntax Questions

From: Hugh Glaser <hg@ecs.soton.ac.uk>
Date: Wed, 09 Jan 2008 19:33:20 +0000
To: SW-forum Web <semantic-web@w3.org>
Message-ID: <C3AAD200.1038B%hg@ecs.soton.ac.uk>

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 Wednesday, 9 January 2008 19:33:53 GMT

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