[redland-dev] Serializer namespace issues

Dave Beckett dave.beckett at bristol.ac.uk
Wed Jul 20 16:33:07 BST 2005


On Wed, 2005-07-20 at 15:16 +0100, Kieron Taylor wrote:
> Danny Ayers wrote:
> > On 7/20/05, Kieron Taylor <krt1 at soton.ac.uk> wrote:
> > 
> >>I am finding that the RDF I parse is being mangled somewhat when I
> >>change and serialize it again.
> > 
> > 
> > Do you please have a sample of the material that's getting mangled?
> > 
> 
> This is a potted version of what the rdfxml serializer produced:
> 
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>   <rdf:Description rdf:nodeID="r1120484797r341954">
>    <ns0:type xmlns:ns0="http://www.w3.org/2000/01/rdf-schema#" 
> rdf:resource="chemschema.rdfs#Calculated"/>
>   </rdf:Description>
> </rdf:RDF>
> 
> In the program I asked it to add a triple of the form:
> 
> <bnode> <http://www.w3.org/2000/01/rdf-schema#type> 
> <http://green.chem.soton.ac.uk/rdf/chemschema.rdfs#Calculated>
> 
> Predicates maintain their namespaces correctly, but resources do not. In 
> this case http://green.chem.soton.ac.uk/rdf/ has been cut off and not 
> re-inserted in the ns0="http:...." form.

You can't abbreviate triple subjects (rdf:about, rdf:nodeID) or triple
objects (rdf:resource, rdf:nodeID) using XML namespaces, only predicates
are affected by that as they are XML names.  subjects and objects that
are URIs *are* affected by the in-scope base URI that's used.

The resource value does seem to be corrupted.  What, if any base URI did
you pass to the serializer?   If it was
http://green.chem.soton.ac.uk/rdf/
then that will be why the resulting URI is relative to that base URI.
Use NULL to get no base, so all the output URIs will be absolute.

> RE: Dave's mention of RDFXML-abbrev, I didn't even know that existed. Is 
> it any good or mega-beta?

"rdfxml-abbrev" has some bugs.  The "rdfxml" one should have no bugs,
unless this is a bug you've found now.

Dave




More information about the redland-dev mailing list