@Override public boolean deleteNamespace(String prefix) { try { RepositoryConnection conn = repo.getConnection(); conn.removeNamespace(prefix); conn.close(); return true; } catch (RepositoryException e) { e.printStackTrace(); return false; } }
@Override public boolean requiresEvaluation(Repository addedStatements, Repository removedStatements) { boolean requiresEvalutation; try (RepositoryConnection addedStatementsConnection = addedStatements.getConnection()) { requiresEvalutation = addedStatementsConnection.hasStatement(null, path, null, false); } try (RepositoryConnection removedStatementsConnection = removedStatements.getConnection()) { requiresEvalutation |= removedStatementsConnection.hasStatement(null, path, null, false); } return requiresEvalutation; }
private static int statementsCount(RepositoryConnection conn, Resource ctx) { RepositoryResult<Statement> statements = conn.getStatements(null, null, null, ctx); int counter = 0; while (statements.hasNext()) { counter++; statements.next(); } return counter; }
@Override public boolean addNamespace(Namespace namespace) { try { RepositoryConnection conn = repo.getConnection(); conn.setNamespace(namespace.getPrefix(), namespace.getNamespaceId()); conn.close(); return true; } catch (RepositoryException e) { e.printStackTrace(); return false; } }
@Override public void add(Resource subject, org.eclipse.rdf4j.model.IRI predicate, Value object, Resource... contexts) throws RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
public ContextAwareConnection(Repository repository) throws RepositoryException { this(repository, repository.getConnection()); }
@Override public boolean isWriteable() { return this.connection.getRepository().isWritable(); }
@Override public ValueFactory getValueFactory() { return repo.getValueFactory(); } }
@Override public boolean addNamespace(Namespace namespace) { try { RepositoryConnection conn = repo.getConnection(); conn.setNamespace(namespace.getPrefix(), namespace.getNamespaceId()); conn.close(); return true; } catch (RepositoryException e) { e.printStackTrace(); return false; } }
@Override public boolean deleteNamespace(String prefix) { try { RepositoryConnection conn = repo.getConnection(); conn.removeNamespace(prefix); conn.close(); return true; } catch (RepositoryException e) { e.printStackTrace(); return false; } }
@Override public boolean requiresEvaluation(Repository addedStatements, Repository removedStatements) { boolean requiresEvalutation; try (RepositoryConnection addedStatementsConnection = addedStatements.getConnection()) { requiresEvalutation = addedStatementsConnection.hasStatement(null, path, null, false); } try (RepositoryConnection removedStatementsConnection = removedStatements.getConnection()) { requiresEvalutation |= removedStatementsConnection.hasStatement(null, path, null, false); } return requiresEvalutation; }
@Override public void add(Iterable<? extends Statement> statements, Resource... contexts) throws RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
@Override public void add(InputStream in, String baseIRI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
@Override public void remove(Statement st, Resource... contexts) throws RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
@Override public void remove(Iterable<? extends Statement> statements, Resource... contexts) throws RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
@Override public void remove(Resource subject, org.eclipse.rdf4j.model.IRI predicate, Value object, Resource... contexts) throws RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
@Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } });
@Override protected RepositoryException convert(Exception e) { return new RepositoryException(e); } });
@Override public void add(Reader reader, String baseIRI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException { throw new RepositoryException(READ_ONLY_MESSAGE); }
@Override public Update prepareUpdate(QueryLanguage arg0, String arg1) throws RepositoryException, MalformedQueryException { throw new RepositoryException(READ_ONLY_MESSAGE); }