use of nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException in project timbuctoo by HuygensING.
the class RdfDescriptionSaver method addValue.
@Override
public void addValue(String subject, String predicate, String value, String dataType, String graph) throws RdfProcessingFailedException {
try {
if (Objects.equals(subject, baseUri) && isDescriptionPredicate(predicate)) {
ValueFactory vf = SimpleValueFactory.getInstance();
model.add(vf.createIRI(subject), vf.createIRI(predicate), vf.createLiteral(value));
}
} catch (Exception e) {
throw new RdfProcessingFailedException(e);
}
}
use of nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException in project timbuctoo by HuygensING.
the class RdfDescriptionSaver method commit.
@Override
public void commit() throws RdfProcessingFailedException {
try {
inputStream.close();
// false for overwrite file (true=concat)
FileWriter newFileWriter = new FileWriter(descriptionFile, false);
Rio.write(model, newFileWriter, RDFFormat.RDFXML);
newFileWriter.flush();
newFileWriter.close();
importStatus.setStatus("Description saved");
} catch (IOException e) {
throw new RdfProcessingFailedException(e);
}
}
use of nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException 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();
}
}
use of nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException 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);
}
}
use of nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.RdfProcessingFailedException 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);
}
}
Aggregations