code: def replace_uri(self, src, dest):
          
  
          # NB: The hypothetical statement <src> <src> <src> will be removed
          # and re-added several times. The subject block will remove it and
          # add <dest> <src> <src>. The predicate block will remove that and
          # add <dest> <dest> <src>. The object block will then remove that
          # and add <dest> <dest> <dest>.
  
          # NB2: The list() call here is necessary. .triples() is a generator:
          # It calculates its matches as it progressively iterates through the
          # graph. Actively changing the graph inside the for loop while the
          # generator is in the middle of examining it risks invalidating the
          # generator and could conceivably make it Just Break, depending on
          # the implementation of .triples(). Wrapping .triples() in a list()
          # forces it to exhaust the generator, running through the entire
          # graph to calculate the list of matches before continuing to the
          # for loop.
  
          subject_triples = list(self.content.triples((src, None, None)))
          for s, p, o in subject_triples:
              self.content.remove((src, p, o))
              self.content.add((dest, p, o))
  
          predicate_triples = list(self.content.triples((None, src, None)))
          for s, p, o in predicate_triples:
              self.content.remove((s, src, o))
              self.content.add((s, dest, o))
  
          object_triples = list(self.content.triples((None, None, src)))
          for s, p, o in object_triples:
              self.content.remove((s, p, src))
              self.content.add((s, p, dest))
docs: Replace a uri reference everywhere it appears in the graph with
          another one. It could appear as the subject, predicate, or object of
          a statement, so for each position loop through each statement that
          uses the reference in that position, remove the old statement, and
          add the replacement.