[redland-dev] Redland Storage backup

Dave Beckett dave at dajobe.org
Mon Mar 29 19:03:39 CEST 2010


On Mon, 29 Mar 2010, Nicholas J Humfrey wrote:

> Hello,
>
> What would be the best approach to serialising an entire store with contexts? I would like to make it easy to do full storage backup/restore. I was hoping to output one of TriG/TriX/N-Quads, but I can't see how that would be easily achieved.
>
> I suspect I would have to implement it all myself, just using the librdf API, but I can't even work out a way of re-using the n-triples escaping code?
>
> Any suggestions on how to go about this?

You need to get the list of graphs and then serialize them one-by-one
to files.

The list of graphs is found using the iterator from 
librdf_model_get_contexts()
http://librdf.org/docs/api/redland-model.html#librdf-model-get-contexts

then use the librdf_node* context objects to serialize each graph
using librdf_model_context_serialize()
http://librdf.org/docs/api/redland-model.html#librdf-model-context-serialize

and create a serializer and write the stream to it.

Dave




More information about the redland-dev mailing list