W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > August 2002

Re: Alternative representation of typed literal nodes in NTriples (and N3)

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Thu, 22 Aug 2002 19:44:41 +0100
To: Patrick.Stickler@nokia.com
cc: w3c-rdfcore-wg <w3c-rdfcore-wg@w3.org>
Message-ID: <8279.1030041881@hoth.ilrt.bris.ac.uk>

>>>Patrick.Stickler@nokia.com said:
> I've been chewing on the representation of typed literal nodes in 
> NTriples in a manner that is both consistent for non-XML and XML
> literals and which is more compatable with use of qnames rather
> than URIrefs, both by N3 as well as in our own examples, since
> it is common practice by the editors to use qnames in the NTriples
> in the specs.
> 
> What I propose is that we keep the current representation of 
> literals in NTriples, and that the datatype be separated from 
> the literal by a comma.

Sorry, I doubt that'll fly -  , is already used extensively in N3 to
separate terms and the lexers may split "a,b" into three tokens.

I avoided added or using any more punctuation since there is a lot
already used or probably going to be.

>    non-XML literal                                                    "25"
>    non-XML literal with lang                                          "25"-en
>    URIref typed non-XML literal                  <http://...#integer>,"25"
>    URIref typed non-XML literal with lang        <http://...#integer>,"25"-en
>    qname typed non-XML literal                            xsd:integer,"25"
>    qname typed non-XML literal with lang                  xsd:integer,"25"-en
> 
>    XML literal                                           xml"<h1>Foo</h1>"
>    XML literal with lang                                 xml"<h1>Foo</h1>"-en
>    URIref typed XML literal              <http://...#h1>,xml"<h1>Foo</h1>"
>    URIref typed XML literal with lang    <http://...#h1>,xml"<h1>Foo</h1>"-en
>    qname typed XML literal                      xhtml:h1,xml"<h1>Foo</h1>"
>    qname typed XML literal with lang            xhtml:h1,xml"<h1>Foo</h1>"-en

It does look better though :)

> Since a comma is not a legal XML NAME character, when joining a qname
> with an XML literal, there is no ambiguity regarding the partitioning
> between the qname and the XML flag 'xml'.
> 
> This keeps both non-XML and XML literals delimited by double quotes, and
> no changes to the current NTriples syntax (other than the prefixing of
> the datatype).
> 
> It also reinforces, IMO, the fact that the typed literal node is a pairing
> of a datatype and a literal, the latter having its own three-part structure
> of XML bit, string, and language code.

Actually I was half wondering about that.  If there was a type URI
for XML itself, could we not use

<uri-for-xml>"<h1>Foo</h1>"

rather than xml"<h1>Foo</h1>"

?

> So, we can use qnames in examples and N3 can adopt typed literal nodes
> without any syntactic ambiguity.

I'll try to get the main N3 developers - Tim and DanC to think about
this, but I should note N3 doesn't handle "foo"-en or xml"foo"-en so
I'm not sure what to suggest next.

However we still don't need qnames in N-Triples - it is syntax sugar,
and a simple test format doesn't need it.

Dave
Received on Thursday, 22 August 2002 14:45:48 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:50:27 EDT