0

If I have a rdflib.Uriref that point to a resource that I do not need any more. How can i remove it safely using rdflib.

If for example I just remove all the triples that refer to it may be a could broke something like a Bnode that is a list.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
vigte
  • 95
  • 1
  • 8

1 Answers1

0

If I have a rdflib.Uriref that point to a resource that I do not need any more. How can i remove it safely using rdflib.

An RDF graph is just a collection of triples. It doesn't contain any resources or nodes independent of those triples.

If for example I just remove all the triples that refer to it may be a could broke something like a Bnode that is a list.

Removing all the triples that use a URI resource is the correct way to "remove it from the graph". There's no way for this to "break" the graph. Whether it invalidates any structure in the graph is another question, but one that you'd have to answer based on the structure that you're putting in the graph. You'd need to check in advance whether the resource appears in any triples that shouldn't be removed.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353