so i found another problem in librdf_stream_get_context... namely that it does not work with hashes storage.

the problem is actually librdf_storage_hashes_context_serialise_get_statement, which overwrites the context_node with NULL. it seems to me that in the case of context_serialise, the context should be the same for every element of the stream, so i just removed the offending update.
see attached patch.

michael

--
"A language that doesn't affect the way you think about programming,
 is not worth knowing." -- Alan Perlis
--- redland-1.0.7/librdf/rdf_storage_hashes.c	Thu Dec 20 22:39:42 2007
+++ redland-1.0.7-hashes_context_serialise/librdf/rdf_storage_hashes.c	Tue May  6 14:03:21 2008
@@ -1595,7 +1595,6 @@
 {
   librdf_storage_hashes_context_serialise_stream_context* scontext=(librdf_storage_hashes_context_serialise_stream_context*)context;
   librdf_hash_datum* v;
-  librdf_node** cnp=NULL;
 
   switch(flags) {
     case LIBRDF_ITERATOR_GET_METHOD_GET_OBJECT:
@@ -1608,20 +1607,14 @@
           return scontext->context_node;
       }
 
-      /* current stuff is out of date - get new cached answers */
-      if(scontext->index_contexts) {
-        if(scontext->context_node)
-          librdf_free_node(scontext->context_node);
-        scontext->context_node=NULL;
-        cnp=&scontext->context_node;
-      }
-      
+      /* note: scontext->context_node is still valid */
+
       librdf_statement_clear(&scontext->current);
 
       v=(librdf_hash_datum*)librdf_iterator_get_value(scontext->iterator);
-      
+
       /* decode value content and optional context */
-      if(!librdf_statement_decode_parts(&scontext->current, cnp,
+      if(!librdf_statement_decode_parts(&scontext->current, NULL,
                                         (unsigned char*)v->data, v->size)) {
         return NULL;
       }
_______________________________________________
redland-dev mailing list
[email protected]
http://lists.librdf.org/mailman/listinfo/redland-dev

Reply via email to