Search in sources :

Example 1 with OptimizedPatchListener

use of nl.knaw.huygens.timbuctoo.v5.dataset.OptimizedPatchListener in project timbuctoo by HuygensING.

the class StoreUpdater method updateListeners.

private void updateListeners() throws RdfProcessingFailedException {
    logString = "Processed {} subjects ({} subjects/s)";
    for (OptimizedPatchListener listener : listeners) {
        listener.start();
    }
    count = 0;
    prevCount = 0;
    prevTime = stopwatch.elapsed(TimeUnit.SECONDS);
    try (Stream<String> subjects = updatedPerPatchStore.ofVersion(currentversion)) {
        final ChangeFetcher getQuads = new ChangeFetcherImpl(truePatchStore, tripleStore, currentversion);
        final Iterator<String> iterator = subjects.iterator();
        while (iterator.hasNext()) {
            final boolean needUpdate = notifyUpdate();
            final String subject = iterator.next();
            for (OptimizedPatchListener listener : listeners) {
                if (needUpdate) {
                    listener.notifyUpdate();
                }
                listener.onChangedSubject(subject, getQuads);
            }
        }
    }
    for (OptimizedPatchListener listener : listeners) {
        listener.finish();
    }
}
Also used : OptimizedPatchListener(nl.knaw.huygens.timbuctoo.v5.dataset.OptimizedPatchListener) ChangeFetcher(nl.knaw.huygens.timbuctoo.v5.dataset.ChangeFetcher)

Aggregations

ChangeFetcher (nl.knaw.huygens.timbuctoo.v5.dataset.ChangeFetcher)1 OptimizedPatchListener (nl.knaw.huygens.timbuctoo.v5.dataset.OptimizedPatchListener)1