Redland does not directly support named graphs. Instead, named graphs can be 
implemented by clients using Redland's 
context facility. I've been trying to do this and have been running into 
difficulties.

 From the release notes for 0.9.17 [1]:

   * Check that duplicate statements are not added to models with the 
librdf_model_add_statement and
     librdf_model_add_statements methods.
   * The methods for adding statements with a context do not check.

While adding statements to the model without a context will not introduce 
duplicates, if a model contains any statement 
with a context, duplicates may be returned. So the duplicate restriction to 
*adding* statements via the 
librdf_model_add_statement(s) methods is misleading because it does not ensure 
that a model will not *return* 
duplicates. To ensure uniqueness, clients must examine each statement, skipping 
those with a context set. Sometimes this 
is not even possible for functions like librdf_model_size or any other function 
that does not accept a context argument.

When querying statements with a particular context, the client again must 
perform duplicate checking since these 
statements aren't checked for duplicates. However this case is not as simple as 
the previous one. The client must keep 
track of all previously seen statements to recognize duplicates. If large 
datasets are queried, this might be 
prohibitive. Doing this for all calls to the library seems like something the 
library should be providing.

Would it be possible to have an option or another api that limits requests to 
only statements without a context? Another 
possibility would be to have a special context name to refer to this set. Also, 
could the context option be added to the 
other functions? The one that's especially important is librdf_model_size. 
Selecting all statements and counting them in 
the client is not very scalable.

There is an outstanding bug report [2] that addresses this that hasn't seen 
much activity. Perhaps the severity and 
priority of this bug could be reconsidered?


-Michael

[1] http://librdf.org/RELEASE.html#rel0_9_17
[2] http://bugs.librdf.org/mantis/view.php?id=108
_______________________________________________
redland-dev mailing list
[email protected]
http://lists.librdf.org/mailman/listinfo/redland-dev

Reply via email to