@Override public void commit() { try { cxn.commit(); } catch (Exception e) { throw new RuntimeException(e); } }
private void loadData(final BigdataSailRepositoryConnection cxn) throws RepositoryException, RDFParseException, IOException { cxn.clear(); cxn.add(new ByteArrayInputStream(DATA.getBytes()), "", DATA_FORMAT); cxn.commit(); }
if (cxn != null) { try { cxn.commit(); } finally { cxn.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 */ @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 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 void loadData(final BigdataSailRepositoryConnection cxn) throws RepositoryException, RDFParseException, IOException { cxn.clear(); cxn.add(new ByteArrayInputStream(DATA.getBytes()), "", DATA_FORMAT); cxn.commit(); }
conn.add(getClass().getResourceAsStream("TestTicket1788.n3"), "", RDFFormat.TURTLE); conn.commit();
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(); } }
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(); } }
/** * Test whether sparql update results in auto-commit. */ public void testCountCommits() throws Exception { BigdataSailRepositoryConnection cxn = null; final BigdataSail sail = getSail(getProperties()); try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); cxn = (BigdataSailRepositoryConnection) repo.getConnection(); final CommitCounter counter = new CommitCounter(); cxn.addChangeLog(counter); cxn.prepareUpdate(QueryLanguage.SPARQL, "insert data { <x:s> <x:p> \"foo\" . }").execute(); cxn.prepareUpdate(QueryLanguage.SPARQL, "insert data { <x:s> <x:p> \"bar\" . }").execute(); cxn.commit(); assertTrue(counter.n == 1); } finally { if (cxn != null) cxn.close(); sail.__tearDownUnitTest(); } }
/** * Test whether sparql update results in auto-commit. */ public void testCountCommits() throws Exception { BigdataSailRepositoryConnection cxn = null; final BigdataSail sail = getSail(getProperties()); try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); cxn = (BigdataSailRepositoryConnection) repo.getConnection(); final CommitCounter counter = new CommitCounter(); cxn.addChangeLog(counter); cxn.prepareUpdate(QueryLanguage.SPARQL, "insert data { <x:s> <x:p> \"foo\" . }").execute(); cxn.prepareUpdate(QueryLanguage.SPARQL, "insert data { <x:s> <x:p> \"bar\" . }").execute(); cxn.commit(); assertTrue(counter.n == 1); } finally { if (cxn != null) cxn.close(); sail.__tearDownUnitTest(); } }