[redland-dev] Default serializer not saving rdf:about

Dave Beckett dave at dajobe.org
Mon Jan 29 00:51:19 UTC 2007


Ricardo J. Méndez wrote:
> Hi,
> 
> I've run into an interesting problem with Redland. I'm using
> 
> raptor-1.4.13
> redland-1.0.5
> rasqal-0.9.13
> 
> When attempting serialization of a model using the default serializator, as
> 
>    serializer=RDF.Serializer()
>    serializer.set_namespace("dc", RDF.Uri("http://xmlns.com/foaf/0.1/"))
>    serializer.set_namespace("rdf",
> RDF.Uri("http://www.w3.org/1999/02/22-rdf-syntax-ns#"))
>    serializer.serialize_model_to_file(out_file, model)
> 
> the resulting output does not contain the rdf:about tags for any of
> the nodes. Instead, they look like
> 
>  <dc:Person rdf:about="">
>    <dc:name>The Name</dc:name>


That's the relative URI handling.  The serializers by default try
to generate the shortest relative URI if they can, or are allowed to
(not in ntriples, it's all absolute).

"" is the document URI, in this case , the filename for 'out_file'
in your example, something like file://path/to/file/

> However, pretty much any other serializer includes it, like
> 
>  <dc:Person rdf:about="http://thename.site.org/">
>    <dc:name>The Name</dc:name>
> 
> if it's rdfxml or rdfxml-abbrev, or as an element if it's ntriples.
> 
> Two questions:
> 
> 1)  Is this behavior a bug?

Feature.

Actually you can turn this off with a serializer feature
called
  relativeURIs          Write relative URIs wherever possible in serializing.
(from rapper -f help)

Feature URI: http://feature.librdf.org/raptor-relativeURIs

> 2) Which one is the default serializer?  I've serialized data using
> RDF.Serializer(), RDF.Serializer("rdfxml"),
> RDF.Serializer("rdfxml-abbrev") and RDF.Serializer("ntriples"), and
> while the default one matches rdfxml-abbrev the closest, the output
> isn't exactly the same.
> 
> I've got some test code if anyone considers it necessary.

The default varies, it's usually RDF/XML (rdfxml) although RDF/XML Abbrev
(rdfxml-abbrev) is a friendlier choice for people.

again: rapper -h shows the names

Dave



More information about the redland-dev mailing list