W3C home > Mailing lists > Public > www-rdf-comments@w3.org > April to June 2005

Re: Error in RDF/XML Syntax Specification?

From: Arjohn Kampman <arjohn.kampman@aduna.biz>
Date: Tue, 05 Apr 2005 10:22:22 +0200
Message-ID: <42524ABE.8060109@aduna.biz>
To: Dave Beckett <dave.beckett@bristol.ac.uk>
Cc: www-rdf-comments@w3.org

Dave Beckett wrote:
> On Fri, 2005-04-01 at 15:22 +0200, Arjohn Kampman wrote:
> 
>>Hi Dave, others,
>>
>>Someone posted a bug report on the Sesame forum for what he thought was
>>an error in Sesame's RDF/XML parser[1]. I had a closer look at the
>>RDF/XML syntax specification[2] and it appears that Sesame strictly
>>adheres to this spec. This, however, surprised me, as I would have
>>expected the data to be correct. Also, the W3C Validation Service[3] did
>>parse the data as expected.
> 
> 
> Note that I'm speaking personally and not for any W3C WG.
> 
> Don't take what that service does as necessarily correct.

Guess you're no longer the editor of the spec? How does the W3C take
care of these post-release reports? It will probably need to be
documented in the errata.

>>The problematic data contains a datatyped (xsd:string) empty literal:
>>
>><?xml version="1.0"?>
>><rdf:RDF
>>     xmlns="foo:bar#"
>>     xmlns:foo="foo:bar#"
>>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>>     xml:base="foo:bar">
>>
>><rdf:Description rdf:ID="ID1">
>>	<foo:prop rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>>	></foo:prop>
>></rdf:Description>
>></rdf:RDF>
>>
>>If my understanding of the grammar in the spec is correct, then this
>>data matches the 'emptyPropertyElt' rule, which does not allow the
>>rdf:datatype attribute to be specified.
> 
> 
> Nope.  It does not match that rule.  rdf:datatype is forbidden on an
> emptyPropertyElt.
> 
> Looking at the rdf/xml grammar rules at
> http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/#section-Infoset-Grammar
> 
> 7.2.21 emptyPropertyElt says the allowed attributes are:
>   set(idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr*))
> 
> and if you expand that you'll find
> 7.2.25 propertyAttr refers to
> 7.2.7 propertyAttributeURIs refers to forbidding the contents of
> 7.2.2 coreSyntaxTerms which includes rdf:datatype.
> 
> Therefore this line SHOULD match instead 7.2.16 literalPropertyElt
> with an empty text() however 7.2.16 only applies to a non-empty text.

Well, 7.2.21 emptyPropertyElt already handles the case where no, or only
the optional rdf:ID attribute is present, generating an empty plain
literal as a result. Therefore, handling the rdf:datatype attribute in
the emptyPropertyElt production might be a good alternative.

> Thus, in my opinion an datatyped RDF-literal with an empty content is
> not covered by the grammar.
> 
> This is a grammar coverage omission of what is legal to write in RDF,
> and should be legal to write in RDF/XML.

I agree. I'll fix this in Sesame/Rio, probably you and Graham (and
others?) should do the same for your parsers so that they exhibit
identical behaviour. Hopefully, someone will pick this up and document
it in the errata.

> (This RDF/XML also is also passed as correct by the non-normative
> RELAX NG schema)

The literalPropertyElt production in the RELAX NG schema contains an
other error, unrelated to the above: it only allows either an rdf:ID
attribute or an rdf:datatype attribute to be specified, but not both.
This is different from the normative grammar in chapter 7.

Thanks so far,

Arjohn
Received on Tuesday, 5 April 2005 08:38:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 21 September 2012 14:16:33 GMT