I'd like to write a Python program that:
The problem I'm having: librdf assigns its own blank identifiers to the blank nodes as the source graph is parsed, so if one of the steps in my transaction (of #4, above) is to delete a blank node, this will fail -- because my local blank node identifier is different from the remote server's blank node identifier.
How can I tackle this? Is there a way to ask librdf to preserve blank node identifiers on parsing a graph? Or some other approach?
Edit: The core issue
Based on Signified's suggestions, here (I suppose) is the crux of my problem: librdf ignores even explicit nodeIDs from the source graph:
Same thing with NTriples:
Since you speak of "graphs", I assume that your queries are
Labelling of blank-nodes
Are the results from the REST interface in RDF/XML? If so, unless there's
For RDF/XML blank-nodes without
So, you shouldn't expect consistent blank-node labelling across different parsers. Similarly, I wouldn't imagine that the bnode labelling of
An easy solution might be to try return results in N-Triples where blank-nodes are explicitly named. (I think that it's a safe assumption that
If not possible (tricky)...
One option might be to not specify the blank node in the remove statement request. This will work fine if the remaining constants uniquely identify a particular triple. Otherwise, you can query Sesame with the blank-nodes as variables: this will return a set of candidate statements to remove. You can then try to figure out which candidate statement you want to delete (maybe using a simple entailment check :O).