rdfredland

Lifetime of RDF nodes in Redland RDF after parsing a model?


I am parsing an RDF_model using librdf_parser_parse_string_into_model. I then retain the librdf_model but free the librdf_parser. It looks to me as if the nodes in the model then have disappeared as well.

So what lifetime does Redland RDF impose on librdf_nodes in this case? Is the the lifetime of the model that contains them (as would seem most convenient) or the lifetime of the parser that created them (as now may be the case)? The documentation seems to be silent on this.


Solution

  • Redland nodes librdf_node are implemented as Raptor terms raptor_term. These are reference counted but not cached in any other way, so are free()-d when they are no longer referenced. Similarly librdf_uri are raptor_uri and work the same way.