Search in sources :

Example 6 with DatabaseWriteException

use of nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException in project timbuctoo by HuygensING.

the class StoreUpdater method deleteQuad.

private void deleteQuad(String subject, String predicate, Direction direction, String object, String valueType, String language) throws RdfProcessingFailedException {
    try {
        final boolean wasChanged = tripleStore.deleteQuad(subject, predicate, direction, object, valueType, language);
        if (wasChanged && currentversion >= 0) {
            truePatchStore.put(subject, currentversion, predicate, direction, false, object, valueType, language);
            updatedPerPatchStore.put(currentversion, subject);
        }
    } catch (DatabaseWriteException e) {
        throw new RdfProcessingFailedException(e);
    }
}
Also used : DatabaseWriteException(nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException) RdfProcessingFailedException(nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException)

Example 7 with DatabaseWriteException

use of nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException in project timbuctoo by HuygensING.

the class StoreUpdater method putQuad.

private void putQuad(String subject, String predicate, Direction direction, String object, String valueType, String language) throws RdfProcessingFailedException {
    try {
        final boolean wasChanged = tripleStore.putQuad(subject, predicate, direction, object, valueType, language);
        if (wasChanged && currentversion >= 0) {
            truePatchStore.put(subject, currentversion, predicate, direction, true, object, valueType, language);
            updatedPerPatchStore.put(currentversion, subject);
        }
    } catch (DatabaseWriteException e) {
        throw new RdfProcessingFailedException(e);
    }
}
Also used : DatabaseWriteException(nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException) RdfProcessingFailedException(nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException)

Example 8 with DatabaseWriteException

use of nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException in project timbuctoo by HuygensING.

the class StoreUpdater method commit.

@Override
public void commit() throws RdfProcessingFailedException {
    try {
        String msg = "processing " + count + " triples took " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds";
        LOG.info(msg);
        importStatus.setStatus(msg);
        stopwatch.reset();
        stopwatch.start();
        updateListeners();
        msg = "post-processing took " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds";
        LOG.info(msg);
        importStatus.setStatus(msg);
        stopwatch.reset();
        stopwatch.start();
        versionStore.setVersion(currentversion);
        commitChanges();
        dbFactory.commitTransaction();
        msg = "committing took " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds";
        LOG.info(msg);
        importStatus.setStatus(msg);
    } catch (DatabaseWriteException | JsonProcessingException e) {
        throw new RdfProcessingFailedException(e);
    }
}
Also used : DatabaseWriteException(nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) RdfProcessingFailedException(nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException)

Aggregations

DatabaseWriteException (nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.DatabaseWriteException)8 RdfProcessingFailedException (nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException)4 Cursor (com.sleepycat.je.Cursor)3 OperationStatus (com.sleepycat.je.OperationStatus)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ChangeType (nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.ChangeType)1 CursorQuad (nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad)1 SchemaUpdateException (nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.SchemaUpdateException)1 Predicate (nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate)1 Type (nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type)1