/** * 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. */ 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); }
/** * 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. */ 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); }
/** * {@inheritDoc} */ public void deleteObject(DOReader oldReader) throws ResourceIndexException { if (_indexLevel > INDEX_LEVEL_OFF) { updateTriples(_generator.getTriplesForObject(oldReader), true); } }
/** * {@inheritDoc} */ public void addObject(DOReader reader) throws ResourceIndexException { if (_indexLevel > INDEX_LEVEL_OFF) { updateTriples(_generator.getTriplesForObject(reader), false); } }
/** * {@inheritDoc} */ public void deleteObject(DOReader oldReader) throws ResourceIndexException { if (_indexLevel > INDEX_LEVEL_OFF) { updateTriples(_generator.getTriplesForObject(oldReader), true); } }
/** * {@inheritDoc} */ public void addObject(DOReader reader) throws ResourceIndexException { if (_indexLevel > INDEX_LEVEL_OFF) { updateTriples(_generator.getTriplesForObject(reader), false); } }