- From: Dave Beckett <dave.beckett@bristol.ac.uk>
- Date: Mon, 4 Apr 2005 16:09:00 +0100
- To: Arjohn Kampman <arjohn.kampman@aduna.biz>
- Cc: www-rdf-comments@w3.org
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. > 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. 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. (This RDF/XML also is also passed as correct by the non-normative RELAX NG schema) > This is not what I was > expecting. Also, the grammar doesn't seem to allow the serialization of > an empty xsd:string object in RDF/XML. Correct. > So, what I would like to know is: is this a bug in the spec and Sesame, > or is it a problem with ARP and the validation service? In my opinion, the bug is in the spec, ARP and the W3C validator have the correct intention but doesn't match the spec, Sesame matches the bug in the spec. The correct RDF triple for the RDF/XML you quote should be (in N-Triples) <foo:bar#ID1> <foo:bar#prop> ""^^<http://www.w3.org/2001/XMLSchema#string> . Let me note that my Raptor parser doesn't get this right either - it loses the datatype. > [1] http://www.openrdf.org/forum/mvnforum/viewthread?thread=525 > [2] http://www.w3.org/TR/rdf-syntax-grammar/ > [3] http://www.w3.org/RDF/Validator/ Dave
Received on Monday, 4 April 2005 15:10:24 UTC