[redland-dev] Re: [patch] librdf_storage_hashes_context_serialise_get_statement

John Fieber jfieber at adobe.com
Wed May 7 16:30:10 BST 2008


On May 7, 2008, at 4:50 AM, Michael Stahl wrote:

> John Fieber wrote:
>> On May 6, 2008, at 5:23 AM, Michael Stahl wrote:
>>> so i found another problem in librdf_stream_get_context... namely  
>>> that it does not work with hashes storage.
>> Do you have a simple test case to illustrate this?  I'm able to  
>> retrieve contexts in streams on hashes storage without trouble.
>
> attached.
> its output:
> object: 298c8   context: 0

[snip]

>    librdf_statement *pStatement2 =
>        librdf_new_statement_from_nodes(pWorld, NULL, NULL, NULL);
>    librdf_stream *pStream =
>        librdf_model_find_statements_in_context(pModel, pStatement2,  
> pContext);
>
>    librdf_statement* pStmt = librdf_stream_get_object(pStream);
>    librdf_node* pCtxt = librdf_stream_get_context(pStream);
>    printf("object: %p\tcontext: %p\n", pStmt, pCtxt);

I'll grant it may be a bug that the context returns NULL in this  
case.  However, you don't exactly need the context from the stream  
because every statement returned by  
librdf_model_find_statements_in_context() will by definition have a  
context node == pContex.  Also note that if you replace  
librdf_model_find_statements_in_context() with  
librdf_model_find_statements(), librdf_stream_get_context() does  
return the context node.

-john



More information about the redland-dev mailing list