[redland-dev] [patch] Re: duplicates in model
    John Fieber 
    jfieber at adobe.com
       
    Mon May  5 16:15:05 BST 2008
    
    
  
On Apr 28, 2008, at 4:20 AM, Michael Stahl wrote:
> so, it seems that librdf_storage_FOO_context_add_statement functions  
> do not check for duplicates; methinks they should.
> how about the following patch for "memory" and "hashes" storages?
> (currently i don't care about others; maybe someone else wants to  
> fix those, or check if they actually don't have the same problem?)
For what its worth, whatever duplicate behavior is desired, it should  
enforced it a higher level so as to achieve consistency across storage  
modules. The user of the model generally shouldn't care[1] what the  
storage back end is and shouldn't be subjected to this sort of change  
based on the particular storage module being used.  Currently, the non- 
context case enforces a no duplicate policy at the model level,  
contingent on the underlying storage having a correct implementation  
backing librdf_model_contains_statement().
What the model and storage APIs are lacking is the context version of  
that: librdf_storage_context_contains_statement().  Granted, the  
abstract storage API, or the model API could implement that based on  
librdf_storage_find_statements_in_context(), but for performance  
reasons, it would be good to delegate to the bottom level when possible.
And on this topic, if duplicates are disallowed in contexts, when  
iterating model/storage statements, there will still appear to be  
duplicates if you ignore the context when iterating.
-john
[1] Unless, of course, the storage module is written expressly to have  
some "special" behavior for a particular application.
    
    
More information about the redland-dev
mailing list