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

> -----Original Message-----
> From: ext Dave Beckett [mailto:dave.beckett@bristol.ac.uk]
> Sent: 22 August, 2002 21:45
> To: Stickler Patrick (NRC/Tampere)
> Cc: w3c-rdfcore-wg
> Subject: Re: Alternative representation of typed literal nodes in
> NTriples (and N3) 
> 
> 
> >>>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.

Rats. Well, perhaps something other than a comma...

> 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 :)

I thought so too.

> 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>"

> ?

No, because well-formed XML is specifically not typed. It is simply well formed.
It's like a arbitrary untyped Unicode string versus a lexical form for xsd:integer.

Also, one want's to know both the type and that it is XML (i.e. that it is a 
complex datatype rather than a simple datatype) ideally without having to
go looking out in the graph for information about the datatype in question.

> 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.

Well, we have two alternatives that I see:

1. Find some punctuation other than a comma, and not an XML Name
character, which can be used to delimit qnames and the XML flag.

-or-

2. Find some other means to denote XML literals than 'xml' which
would maintain the explicit delimitation between the prefixed 
datatype qname and the literal.

I'm happy with either. I just want to see consistency between
non-XML and XML typed literals.

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

True, but we use qnames in most of the NTriples examples in the specs,
so we still need to be able to use qnames with typed literal nodes.

Received on Thursday, 22 August 2002 15:10:07 UTC