lod_set_storage

Set a new librdf storage to be used by a context

Synopsis

#include <liblod.h>

int lod_set_storage(LODCONTEXT *context, librdf_storage *storage);

Description

lod_set_storage sets or resets the librdf_storage object associated with context.

Any existing librdf_storage associated with the context will be discarded, freeing it (using librdf_free_storage) if it was automatically allocated by liblod, as is the case when a context is initially created.

If storage is NULL, a new in-memory librdf_storage will be allocated and associated with context. This object will be automatically destroyed when it is no longer required.

If storage is not NULL, then the supplied librdf_storage will be associated with context. liblod will not automatically destroy this librdf_storage object when it is is no longer required, and it is the calling application's responsibility to do so.

Note

Changing the librdf_storage associated with context will also cause the associated librdf_model to be discarded (and destroyed, if they were automatically allocated).

Caution

Do not destroy a librdf_storage object associated with a context until after it has either been replaced (via another call to lod_set_storage), or the context itself has been destroyed (by lod_destroy).

See also

liblod, lod_storage, lod_create, lod_destroy, lod_errmsg, librdf_new_storage_with_options, librdf_free_storage.