Search in sources :

Example 46 with SailException

use of org.openrdf.sail.SailException in project blueprints by tinkerpop.

the class SailVertex method updateLiteral.

private void updateLiteral(final Literal oldLiteral, final Literal newLiteral) {
    try {
        final Set<Statement> statements = new HashSet<Statement>();
        final CloseableIteration<? extends Statement, SailException> results = this.graph.getSailConnection().get().getStatements(null, null, oldLiteral, false);
        while (results.hasNext()) {
            statements.add(results.next());
        }
        results.close();
        this.graph.getSailConnection().get().removeStatements(null, null, oldLiteral);
        for (Statement statement : statements) {
            SailHelper.addStatement(statement.getSubject(), statement.getPredicate(), newLiteral, statement.getContext(), this.graph.getSailConnection().get());
        }
    } catch (SailException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
Also used : Statement(org.openrdf.model.Statement) SailException(org.openrdf.sail.SailException) HashSet(java.util.HashSet)

Aggregations

SailException (org.openrdf.sail.SailException)46 RyaDAOException (org.apache.rya.api.persist.RyaDAOException)17 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)14 RyaClientException (org.apache.rya.api.client.RyaClientException)13 SailConnection (org.openrdf.sail.SailConnection)12 AccumuloException (org.apache.accumulo.core.client.AccumuloException)11 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)11 Sail (org.openrdf.sail.Sail)11 InferenceEngineException (org.apache.rya.rdftriplestore.inference.InferenceEngineException)10 URI (org.openrdf.model.URI)10 RepositoryException (org.openrdf.repository.RepositoryException)10 MalformedQueryException (org.openrdf.query.MalformedQueryException)9 InstanceDoesNotExistException (org.apache.rya.api.client.InstanceDoesNotExistException)8 Statement (org.openrdf.model.Statement)8 SailRepository (org.openrdf.repository.sail.SailRepository)7 SailRepositoryConnection (org.openrdf.repository.sail.SailRepositoryConnection)7 Resource (org.openrdf.model.Resource)5 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)4