- From: Pierre-Antoine Champin <swlists-040405@champin.net>
- Date: Mon, 24 Nov 2008 11:07:44 +0000
- To: Toby A Inkster <tai@g5n.co.uk>
- CC: Semantic Web <semantic-web@w3.org>
Hi Toby, first, there is a small confusion in what you write. There are two kinds of ordered collections: rdf:Seq and rdf:List. an rdf:Seq looks like that (as the value of property ex:foo) <rdf:Description><ex:foo> <rdf:Seq rdf:node="theSeq"> <rdf:li><rdf:Descriprion rdf:about="#item1" /></rdf:li> <rdf:li><rdf:Descriprion rdf:about="#item2" /></rdf:li> <rdf:li><rdf:Descriprion rdf:about="#item3" /></rdf:li> </rdf:Seq> </ex:foo></rdf:Description> which is equivalent to <rdf:Description><ex:foo> <rdf:Seq rdf:node="theSeq"> <rdf:_1><rdf:Descriprion rdf:about="#item1" /></rdf:_1> <rdf:_2><rdf:Descriprion rdf:about="#item2" /></rdf:_2> <rdf:_3><rdf:Descriprion rdf:about="#item3" /></rdf:_3> </rdf:Seq> </ex:foo></rdf:Description> an rdf:List looks like (as the value of property ex:foo) <rdf:Description> <ex:foo rdf:parseType="Collection"> <rdf:Description rdf:about="#item1" /> <rdf:Description rdf:about="#item1" /> <rdf:Description rdf:about="#item1" /> </ex:foo> </rdf:Description> which is equivalent to <rdf:Description> <ex:foo> <rdf:List> <rdf:first><rdf:Description rdf:about="#item1" /></rdf:first> <rdf:rest rdf:parseType="Resource"> <rdf:first><rdf:Description rdf:about="#item2" /></rdf:first> <rdf:rest rdf:parseType="Resource"> <rdf:first><rdf:Description rdf:about="#item3" /></rdf:first> <rdf:rest rdf:resource="&rdf;nil"/> </rdf:rest> </rdf:rest> </rdf:List> </ex:foo> </rdf:Description> As you can see, the two are quite different. The main difference is that nothing prevents an rdf:Seq to be extended (you could add an rdf:_4 property to it), while an rdf:List is closed by the final <rdf:nil>. So first of all, you should decide if what you need is an rdf:Seq or an rdf:List. Now, to answer your question, rdf:parseType and rdf:nodeID are mutually exclusive, so the quick answer is no. A workaround would be to explicitly declare the list, with a nodeID, and use parseTyp in the rdf:rest of the list. <rdf:Description> <ex:foo> <rdf:List> <rdf:first><rdf:Description rdf:about="#item1" /></rdf:first> <rdf:rest rdf:parseType="Collection"> <rdf:Description rdf:about="#item2" /> <rdf:Description rdf:about="#item3" /> </rdf:rest> </rdf:List> </ex:foo> </rdf:Description> Not the most elegant, but it does the trick. pa Toby A Inkster a écrit : > > Little question about using two features of RDF/XML in conjunction. Say > I have the following RDF/XML: > > <rdf:Description> > <ex:foo> > <rdf:List rdf:nodeID="theList"> > <rdf:_1><rdf:Description rdf:about="#i1" /></rdf:_1> > <rdf:_2><rdf:Description rdf:about="#i2" /></rdf:_2> > <rdf:_3><rdf:Description rdf:about="#i3" /></rdf:_3> > </rdf:List> > </ex:foo> > </rdf:Description> > > Now, this can be simplified, removing the rdf:List and rdf:_n stuff, > using parseType="Collection": > > <rdf:Description> > <ex:foo rdf:parseType="Collection"> > <rdf:Description rdf:about="#i1" /> > <rdf:Description rdf:about="#i2" /> > <rdf:Description rdf:about="#i3" /> > </ex:foo> > </rdf:Description> > > But note now that the nodeID for the list no longer has an element upon > which to be hung. If I want to refer to the same list again, I can't > reference it as a named node. Is there a way around it? Can I use, for > instance, rdf:nodeID on the <ex:foo/> element? >
Received on Monday, 24 November 2008 11:08:31 UTC