[redland-dev] Parser incorrectly interprets Blank Nodes on reload...

Brian Holdsworth holdswob33 at yahoo.com
Mon Jan 24 05:07:50 PST 2005


Thanks Simon.  A little experimentation seems to
indicate your assumption is correct.  Being new to RDF
myself, I did not catch this.

It seems the serializer correctly uses rdf:nodeID when
making the forward references (i.e. when the blank
node is the target).  However, it uses rdf:about when
it writes out the statements that have the blank node
as the subject.  That seems like a bug to me.

I am accomplishing my serialization thusly:

librdf_serializer* serializer =
librdf_new_serializer(RDFWorld, "rdfxml",
            NULL, NULL);
librdf_serializer_serialize_model_to_file(serializer,
xmlfile.c_str(), base_uri, rdf_model);

I will dig into these functions and see if I can
locate a spot to insert a fix.

- Brian


--- Simon Cross <simon at sanbi.ac.za> wrote:

> Hi Brian,
> 
> > I am seeing a strange behavior on my model when I
> > re-parse it after using the rdfxml serializer.  My
> > model has lots of blank node identifiers.  When I
> > serialize it to a rdfxml file, I get statements
> such
> > as this related to the blank nodes:
> > 
> >   <rdf:Description rdf:about="r1r377">
> >     <rdf:value>843-218-6669</rdf:value>
> >   </rdf:Description>
> 
> I think the problem is in the way blank nodes are
> being serialized, not
> in the RDF/XML parsing.  The RDF Primer bit on
> RDF/XML [1] says:
> 
> A blank node is referred to in RDF/XML using an
> rdf:nodeID attribute,
> with a blank node identifier as its value, in places
> where the URIref of
> a resource would otherwise appear. Specifically, a
> statement with a
> blank node as its subject can be written in RDF/XML
> using an
> rdf:Description element with an rdf:nodeID attribute
> instead of an
> rdf:about attribute.
> 
> So the correct serialization would be:
> 
>   <rdf:Description rdf:nodeID="r1r377">
>      <rdf:value>843-218-6669</rdf:value>
>   </rdf:Description>
> 
> The parser seems to correctly treat the rdf:about as
> specifying a URI
> for a non-blank node.
> 
> I've only been playing with RDF for a few weeks so
> don't take any of
> this as gospel. :)
> 
> [1] http://www.w3.org/TR/rdf-primer/#rdfxml
> 
> Schiavo
> Simon
> 
> 



More information about the redland-dev mailing list