0

I am merging RDF data from various remote sources using ConsecutiveGraph.parse().

Now I would like to have a way to update the data of individual sources, without affecting the other ones and the relations between them.

The triples from the various sources might overlap, so it has to be ensured that only the triples coming from a specific source get deleted before the update.

Torsten Knodt
  • 477
  • 1
  • 5
  • 20

1 Answers1

0

Each graph in a ConjunctiveGraph has its own ID - whether you explicitly set it or not. Just update the particular graph you want and export them individually.

If you want to do something more complex than this, such as keeping track of where new data you’ve created perhaps in the default graph (the unnamed graph you get automatically), you’re going to need to use some other method of tracking triples. Look up “reification” for how to annotate triples with more information.

Nicholas Car
  • 1,164
  • 4
  • 7
  • Thanks, but how can I delete the triples from one individual "sub-"graph or the whole graph? I saw that I can read the contexts, but did not find a way to get something like a sub-graph for this context. – Torsten Knodt Apr 27 '20 at 17:48
  • See the deocumentation for remove: https://rdflib.readthedocs.io/en/stable/apidocs/rdflib.html#rdflib.graph.Graph.remove: "If the triple does not provide a context attribute, removes the triple from all contexts." – Nicholas Car May 10 '20 at 01:30