/** * Return an updatable connection. * * @throws RepositoryException */ private BigdataSailRepositoryConnection getConnection() throws RepositoryException { final BigdataSailRepositoryConnection c = m_repo.getConnection(); c.setAutoCommit(false); return c; }
/** * Return an updatable connection. * * @throws RepositoryException */ private BigdataSailRepositoryConnection getConnection() throws RepositoryException { final BigdataSailRepositoryConnection c = m_repo.getConnection(); c.setAutoCommit(false); return c; }
private RepositoryConnection getRepositoryConnection ( final BigdataSail sail ) throws RepositoryException { final BigdataSailRepository repo = new BigdataSailRepository ( sail ) ; final BigdataSailRepositoryConnection cxn = ( BigdataSailRepositoryConnection )repo.getConnection () ; cxn.setAutoCommit ( false ) ; return cxn ; }
/** * Utility to load statements from a resource */ @Override public void load(final URL n3, final RDFFormat rdfFormat) throws IOException, RDFParseException, RepositoryException { final InputStream in = n3.openConnection().getInputStream(); try { final Reader reader = new InputStreamReader(in); // FIXME: Loads into server directly, should change later to load // view ObjectManager final BigdataSailRepositoryConnection m_cxn = repo.getConnection(); try { m_cxn.setAutoCommit(false); m_cxn.add(reader, "kb", rdfFormat); m_cxn.commit(); } finally { m_cxn.close(); } } finally { in.close(); } }
/** * Utility to load n3 statements from a resource */ public void load(final URL n3, final RDFFormat rdfFormat) throws IOException, RDFParseException, RepositoryException { final InputStream in = n3.openConnection().getInputStream(); try { final Reader reader = new InputStreamReader(in); try { final BigdataSailRepositoryConnection cxn = m_repo .getConnection(); try { cxn.setAutoCommit(false); cxn.add(reader, "", rdfFormat); cxn.commit(); } finally { cxn.close(); } } finally { reader.close(); } } finally { in.close(); } }
/** * Utility to load statements from a resource */ private void load(final URL n3, final RDFFormat rdfFormat) throws IOException, RDFParseException, RepositoryException { final InputStream in = n3.openConnection().getInputStream(); try { final Reader reader = new InputStreamReader(in); // FIXME: Loads into server directly, should change later to load // view ObjectManager final BigdataSailRepositoryConnection m_cxn = repo.getConnection(); try { m_cxn.setAutoCommit(false); m_cxn.add(reader, "kb", rdfFormat); m_cxn.commit(); } finally { m_cxn.close(); } } finally { in.close(); } }
/** * Utility to load statements from a resource */ @Override public void load(final URL n3, final RDFFormat rdfFormat) throws IOException, RDFParseException, RepositoryException { final InputStream in = n3.openConnection().getInputStream(); try { final Reader reader = new InputStreamReader(in); // FIXME: Loads into server directly, should change later to load // view ObjectManager final BigdataSailRepositoryConnection m_cxn = repo.getConnection(); try { m_cxn.setAutoCommit(false); m_cxn.add(reader, "kb", rdfFormat); m_cxn.commit(); } finally { m_cxn.close(); } } finally { in.close(); } }
/** * Utility to load n3 statements from a resource */ public void load(final URL n3, final RDFFormat rdfFormat) throws IOException, RDFParseException, RepositoryException { final InputStream in = n3.openConnection().getInputStream(); try { final Reader reader = new InputStreamReader(in); try { final BigdataSailRepositoryConnection cxn = m_repo .getConnection(); try { cxn.setAutoCommit(false); cxn.add(reader, "", rdfFormat); cxn.commit(); } finally { cxn.close(); } } finally { reader.close(); } } finally { in.close(); } }
/** * Utility to load statements from a resource */ private void load(final URL n3, final RDFFormat rdfFormat) throws IOException, RDFParseException, RepositoryException { final InputStream in = n3.openConnection().getInputStream(); try { final Reader reader = new InputStreamReader(in); // FIXME: Loads into server directly, should change later to load // view ObjectManager final BigdataSailRepositoryConnection m_cxn = repo.getConnection(); try { m_cxn.setAutoCommit(false); m_cxn.add(reader, "kb", rdfFormat); m_cxn.commit(); } finally { m_cxn.close(); } } finally { in.close(); } }
private RepositoryConnection getRepositoryConnection ( final BigdataSail sail ) throws RepositoryException { final BigdataSailRepository repo = new BigdataSailRepository ( sail ) ; final BigdataSailRepositoryConnection cxn = ( BigdataSailRepositoryConnection )repo.getConnection () ; cxn.setAutoCommit ( false ) ; return cxn ; }
conn.setAutoCommit(false);
public void testSimpleSSSP() throws Exception { final BigdataSail sail = getSail(); sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = repo.getConnection(); cxn.setAutoCommit(false); try { cxn.add(open("sssp.ttl"), "", RDFFormat.TURTLE); cxn.commit(); log.trace("\n" + cxn.getTripleStore().dumpStore()); final String query = IOUtils.toString(open("sssp.rq")); log.trace("\n" + query); final TupleQuery tqr = cxn.prepareTupleQuery(QueryLanguage.SPARQL, query); final TupleQueryResult result = tqr.evaluate(); while (result.hasNext()) { log.trace(result.next()); } result.close(); } finally { cxn.close(); sail.__tearDownUnitTest(); } }
/** * This version uses the namespace and timestamp provided by the caller. * * @param namespace * @param timestamp * @return * @throws RepositoryException * @throws DatasetNotFoundException */ protected BigdataSailRepositoryConnection getQueryConnection( final String namespace, final long timestamp) throws RepositoryException { // Wrap with SAIL. final BigdataSail sail = new BigdataSail(namespace, getIndexManager()); final BigdataSailRepository repo = new BigdataSailRepository(sail); repo.initialize(); if (TimestampUtility.isReadOnly(timestamp)) { return (BigdataSailRepositoryConnection) repo.getReadOnlyConnection(timestamp); } // Read-write connection. final BigdataSailRepositoryConnection conn = repo.getConnection(); conn.setAutoCommit(false); return conn; }
/** * Return a connection for the namespace. If the task is associated with * either a read/write transaction or an {@link ITx#UNISOLATED} view of the * indices, the connection may be used to read or write on the namespace. * Otherwise the connection will be read-only. * * @return The connection. * * @throws SailException * @throws RepositoryException * @throws DatasetNotFoundException * if the specified namespace does not exist. */ protected BigdataSailRepositoryConnection getConnection() throws SailException, RepositoryException { // Wrap with SAIL. final BigdataSail sail = new BigdataSail(namespace, getIndexManager()); final BigdataSailRepository repo = new BigdataSailRepository(sail); repo.initialize(); final BigdataSailRepositoryConnection conn = repo.getConnection(); conn.setAutoCommit(false); // Setup a change listener. It will notice the #of mutations. conn.addChangeLog(new SailChangeLog()); return conn; }
/** * This version uses the namespace and timestamp provided by the caller. * * @param namespace * @param timestamp * @return * @throws RepositoryException * @throws DatasetNotFoundException */ protected BigdataSailRepositoryConnection getQueryConnection( final String namespace, final long timestamp) throws RepositoryException { // Wrap with SAIL. final BigdataSail sail = new BigdataSail(namespace, getIndexManager()); final BigdataSailRepository repo = new BigdataSailRepository(sail); repo.initialize(); if (TimestampUtility.isReadOnly(timestamp)) { return (BigdataSailRepositoryConnection) repo.getReadOnlyConnection(timestamp); } // Read-write connection. final BigdataSailRepositoryConnection conn = repo.getConnection(); conn.setAutoCommit(false); return conn; }
/** * Return a connection for the namespace. If the task is associated with * either a read/write transaction or an {@link ITx#UNISOLATED} view of the * indices, the connection may be used to read or write on the namespace. * Otherwise the connection will be read-only. * * @return The connection. * * @throws SailException * @throws RepositoryException * @throws DatasetNotFoundException * if the specified namespace does not exist. */ protected BigdataSailRepositoryConnection getConnection() throws SailException, RepositoryException { // Wrap with SAIL. final BigdataSail sail = new BigdataSail(namespace, getIndexManager()); final BigdataSailRepository repo = new BigdataSailRepository(sail); repo.initialize(); final BigdataSailRepositoryConnection conn = repo.getConnection(); conn.setAutoCommit(false); // Setup a change listener. It will notice the #of mutations. conn.addChangeLog(new SailChangeLog()); return conn; }
repo.initialize(); final BigdataSailRepositoryConnection cxn = repo.getConnection(); cxn.setAutoCommit(false);
conn.setAutoCommit(false);
public void testSimpleSSSP() throws Exception { final BigdataSail sail = getSail(); sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = repo.getConnection(); cxn.setAutoCommit(false); try { cxn.add(open("sssp.ttl"), "", RDFFormat.TURTLE); cxn.commit(); log.trace("\n" + cxn.getTripleStore().dumpStore()); final String query = IOUtils.toString(open("sssp.rq")); log.trace("\n" + query); final TupleQuery tqr = cxn.prepareTupleQuery(QueryLanguage.SPARQL, query); final TupleQueryResult result = tqr.evaluate(); while (result.hasNext()) { log.trace(result.next()); } result.close(); } finally { cxn.close(); sail.__tearDownUnitTest(); } }
repo.initialize(); final BigdataSailRepositoryConnection cxn = repo.getConnection(); cxn.setAutoCommit(false);