W3C home > Mailing lists > Public > www-rdf-interest@w3.org > August 2004

Re: RDF/XML Syntax Oddity

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Wed, 11 Aug 2004 12:45:20 +0100
To: Ian Davis <iand@internetalchemy.org>
Cc: www-rdf-interest@w3.org
Message-Id: <20040811124520.05e95dcc@hoth.ilrt.bris.ac.uk>

On Wed, 11 Aug 2004 12:06:42 +0100, Ian Davis <iand@internetalchemy.org> wrote:
> The following RDF/XML different results depending on the parser used:
> 
> <rdf:RDF
>    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>    xmlns:ns1="http://example.com/">
> 
>    <rdf:Description>
>      <ns1:pred rdf:value="bar"><rdf:Description/></ns1:pred>
>    </rdf:Description>
> </rdf:RDF>
> 
> Raptor and James Carlyle's XSLT based parser both give a single triple 
> of the form:
> 
> _:genid1 <http://example.com/pred> _:genid2 .
> 
> The W3C online validator gives two triples:
> 
> genid:ARP76637 	http://www.w3.org/1999/02/22-rdf-syntax-ns#value 	"bar" .
> genid:ARP76636 	http://example.com/pred 	genid:ARP76637 .
> 
> and an error: "Syntax error when processing start element 
> rdf:Description. rdf:Description elements generally may only occur to 
> describe an object.[Line = 4, Column = 30]"
> 
> I'm not entirely sure who is right. Does anyone else have any ideas?

First terminology. In this example, rdf:Description is a node element,
ns1:pred is a property element and rdf:value is a property attribute.

ARP is correct in generating an error.  There are actually two.

1) A property element can only have property attributes if it is an
   empty element[1]

This would have been ok:
      <ns1:pred rdf:value="bar"></ns1:pred>

(or  <ns1:pred rdf:value="bar"/> )


2) A node element cannot appear as the value of a property element
except in two cases. Firstly when it has attribute
rdf:parseType="Collection"[2] expecting a set of node elements
otherwise there are no property attributes at all[3] when one node
element is expected.

So these would have been ok:
      <ns1:pred rdf:parseType="Collection"><rdf:Description/></ns1:pred>

      <ns1:pred><rdf:Description/></ns1:pred>


It is an implementation decision at what point to check these cases
but the rdf/xml document above should generate an error (or two).


I note in passing that the nxml-mode in emacs for RDF/XML using the
relaxng schema correctly points out there is an error - very handy :)

Dave

[1] http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/#emptyPropertyElt
[2] http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/#parseTypeCollectionPropertyElt
[3] http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/#resourcePropertyElt
Received on Wednesday, 11 August 2004 11:46:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:57 UTC