code: private void updateTripleDiffs(Set<Triple> existing, Set<Triple> desired)
              throws ResourceIndexException {
  
          // Delete any existing triples that are no longer desired,
          // leaving the ones we want in place
          HashSet<Triple> obsoleteTriples = new HashSet<Triple>(existing);
          obsoleteTriples.removeAll(desired);
          updateTriples(obsoleteTriples, true);
  
          // Add only new desired triples
          HashSet<Triple> newTriples = new HashSet<Triple>(desired);
          newTriples.removeAll(existing);
          updateTriples(newTriples, false);
  
      }
docs: Computes the difference between the given sets and applies the
  appropriate deletes and adds to the triplestore. If _syncUpdates is true,
  changes will be flushed before returning.