本文介绍了解析模型后 Redland RDF 中 RDF 节点的生命周期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 librdf_parser_parse_string_into_model 解析 RDF_model.然后我保留 librdf_model 但释放 librdf_parser.在我看来,模型中的节点似乎也消失了.

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.

那么在这种情况下,Redland RDFlibrdf_node 的生命周期是多少?是包含它们的模型的生命周期(看起来最方便)还是创建它们的解析器的生命周期(现在可能是这种情况)?文档似乎对此保持沉默.

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.

推荐答案

Redland 节点 librdf_node 实现为 Raptor 术语 raptor_term.这些被引用计数但不会以任何其他方式缓存,所以当它们不再被引用时 free()-d 也是如此.类似地,librdf_uriraptor_uri 并且工作方式相同.

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.

这篇关于解析模型后 Redland RDF 中 RDF 节点的生命周期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 18:10