[Fwd: Turtle - Terse RDF Triple Language doc 2007-11-20 update]

View: New views
3 Messages — Rating Filter:   Alert me  

[Fwd: Turtle - Terse RDF Triple Language doc 2007-11-20 update]

by Dan Brickley-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Dear Cwm/N3 people,

Could you help Dave narrow the gap between Turtle and SPARQL notation?
See attached fwd for details. We'd gain a lot of explainability if
Turtle simply had the same syntax as SPARQL. Is there any strong reason
not to nudge N3 and Cwm in this direction too?

cheers,

Dan


Last week I made another update to Turtle, this time
a major document reorganisation.  There's a new syntax intro
section 2 and I tidied the grammar to remove commentary and
the required use of whitespace in most cases.  Other sections
have been removed or merged.

One thing I was thinking about, comparing with SPARQL
is the difference in quoting for literals.  SPARQL allows
'foo' and '''foo''' as well as "foo" and """foo"" but
Turtle only uses double quotes.  I need more information
on whether to add this, does this causes N3/cwm problems?

The other SPARQL issue to consider is the allowed
characters in prefixed names.  SPARQL has slightly
different rules that allow numbers and '.'s in different
places.

See
  Turtle - Terse RDF Triple Language 20 November 2007
  http://www.dajobe.org/2004/01/turtle/

All changes:
  http://www.dajobe.org/2004/01/turtle/#sec-changelog

Dave



Re: [Fwd: Turtle - Terse RDF Triple Language doc 2007-11-20 update]

by Tim Berners-Lee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



>
> One thing I was thinking about, comparing with SPARQL
> is the difference in quoting for literals.  SPARQL allows
> 'foo' and '''foo''' as well as "foo" and """foo"" but
> Turtle only uses double quotes.  I need more information
> on whether to add this, does this causes N3/cwm problems?
>

Cwm has always had triple-double-quote, which are like python and, I  
think,
invaluable for multi-line strings.

The single quotes and back quotes were reserved.
I wish they had been reserved in SPARQL too.
It is the sort of thing that, once you've allowed them, you can't  
reclaim them --
and then you find you want to extend the language and you are hosed as  
you have no characters left.

Single quotes could for example be used as:

- a different sort for string, one in which variable substitution occurs
   as in { ?x name ?y; phone ?z }  =>  { 'You can call $y on the phone  
at $z for more information' }.

- Nested quotes of some form with backquote, such as   `foaf:Person'  
meaning the string of the URI of that symbol, as in       myStatemet  
rdf:predicateURI  `foaf:knows'.

- Embedding XML  as a shorter syntax for XML literals
        foo s:comment   '<em>Don't try this at home</em>'

etc

What do people think?  The SPARQL design seems to have been to just  
use up the language space with no  thought for the future expansion.  
Also using up the $sign as a synonym for ?.

Tim

> The other SPARQL issue to consider is the allowed
> characters in prefixed names.  SPARQL has slightly
> different rules that allow numbers and '.'s in different
> places.
>
> See
>  Turtle - Terse RDF Triple Language 20 November 2007
>  http://www.dajobe.org/2004/01/turtle/
>
> All changes:
>  http://www.dajobe.org/2004/01/turtle/#sec-changelog
>
> Dave
>
>
>
>



RE: [Fwd: Turtle - Terse RDF Triple Language doc 2007-11-20 update]

by Seaborne, Andy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


-------- Original Message --------

> From: Tim Berners-Lee <>
> Date: 26 November 2007 01:05
>
> > One thing I was thinking about, comparing with SPARQL is the
> > difference in quoting for literals.  SPARQL allows 'foo' and '''foo'''
> > as well as "foo" and """foo"" but Turtle only uses double quotes.  I
> > need more information on whether to add this, does this causes N3/cwm
> > problems?
> >
>
> Cwm has always had triple-double-quote, which are like python and, I
> think, invaluable for multi-line strings.
>
> The single quotes and back quotes were reserved.
> I wish they had been reserved in SPARQL too.
> It is the sort of thing that, once you've allowed them, you can't
> reclaim them -- and then you find you want to extend the language and
> you are hosed as you have no characters left.

Single quotes in SPARQL enable easier embedding of SPARQL queries in language strings.  Language strings are often delimited by " only (pace Python) and putting in \" obfusticates.  It's quite common to want to put a literal in a query so this is not an uncommon case.  It's the double-quotes that are questionable.

> Single quotes could for example be used as:
>
> - a different sort for string, one in which variable substitution occurs
>    as in { ?x name ?y; phone ?z }  =>  { 'You can call $y on the phone
> at $z for more information' }.

There are lots of designs that would enable this - I find choosing one which is the other way round from sh quite confusing.  What about the other style with unlikely-as-plain substitution markers, like using ${y}?

>
> - Nested quotes of some form with backquote, such as   `foaf:Person'
> meaning the string of the URI of that symbol, as in       myStatemet
> rdf:predicateURI  `foaf:knows'.

As the backquote is leading, this is not precluded by single quotes for strings although using `` is more obvious to me.

>
> - Embedding XML  as a shorter syntax for XML literals
>         foo s:comment   '<em>Don't try this at home</em>'

Didn't N-Triples have a form that was removed for x"<em>Don't try this at home</em>".  Using "xml" for XML literal (c.f. a for rdf:type):

"<em>Don't try this at home</em>"^^xml

>
> etc
>
> What do people think?  The SPARQL design seems to have been to just use
> up the language space with no  thought for the future expansion.
> Also using up the $sign as a synonym for ?.
>
> Tim
>
> > The other SPARQL issue to consider is the allowed characters in
> > prefixed names.  SPARQL has slightly different rules that allow
> > numbers and '.'s in different places.
> >
> > See
> >  Turtle - Terse RDF Triple Language 20 November 2007
> > http://www.dajobe.org/2004/01/turtle/
> >
> > All changes:
> >  http://www.dajobe.org/2004/01/turtle/#sec-changelog
> >
> > Dave

LightInTheBox - Buy quality products at wholesale price!