@Test public void testEmptyRollback() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.begin(); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.isEmpty(), is(equalTo(false))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.rollback(); assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(testCon2.isEmpty(), is(equalTo(true))); }
public void testEmptyCommit() throws Exception { assertTrue(testCon.isEmpty()); assertTrue(testCon2.isEmpty()); testCon.setAutoCommit(false); testCon.add(vf.createBNode(), vf.createURI("urn:pred"), vf.createBNode()); assertFalse(testCon.isEmpty()); assertTrue(testCon2.isEmpty()); testCon.commit(); assertFalse(testCon.isEmpty()); assertFalse(testCon2.isEmpty()); }
@Test public void testEmptyCommit() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.begin(); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.isEmpty(), is(equalTo(false))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.commit(); testCon2.close(); testCon2 = testRepository.getConnection(); assertThat(testCon.isEmpty(), is(equalTo(false))); assertThat(testCon2.isEmpty(), is(equalTo(false))); }
public void testEmptyRollback() throws Exception { assertTrue(testCon.isEmpty()); assertTrue(testCon2.isEmpty()); testCon.setAutoCommit(false); testCon.add(vf.createBNode(), vf.createURI("urn:pred"), vf.createBNode()); assertFalse(testCon.isEmpty()); assertTrue(testCon2.isEmpty()); testCon.rollback(); assertTrue(testCon.isEmpty()); assertTrue(testCon2.isEmpty()); }
@Test public void testInferredStatementCount() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); int inferred = getTotalStatementCount(testCon); URI root = vf.createURI("urn:root"); testCon.add(root, RDF.TYPE, RDF.LIST); testCon.remove(root, RDF.TYPE, RDF.LIST); assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(getTotalStatementCount(testCon), is(equalTo(inferred))); }
public void testInferredStatementCount() throws Exception { assertTrue(testCon.isEmpty()); int inferred = getTotalStatementCount(testCon); URI root = vf.createURI("urn:root"); testCon.add(root, RDF.TYPE, RDF.LIST); testCon.remove(root, RDF.TYPE, RDF.LIST); assertTrue(testCon.isEmpty()); assertEquals(inferred, getTotalStatementCount(testCon)); }
@Test public void testRemoveStatements() throws Exception { testCon.begin(); testCon.add(bob, name, nameBob); testCon.add(alice, name, nameAlice); testCon.commit(); assertThat(testCon.hasStatement(bob, name, nameBob, false), is(equalTo(true))); assertThat(testCon.hasStatement(alice, name, nameAlice, false), is(equalTo(true))); testCon.remove(bob, name, nameBob); assertThat(testCon.hasStatement(bob, name, nameBob, false), is(equalTo(false))); assertThat(testCon.hasStatement(alice, name, nameAlice, false), is(equalTo(true))); testCon.remove(alice, null, null); assertThat(testCon.hasStatement(alice, name, nameAlice, false), is(equalTo(false))); assertThat(testCon.isEmpty(), is(equalTo(true))); }
@Test public void testEmptyRollback() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.begin(); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.isEmpty(), is(equalTo(false))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.rollback(); assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(testCon2.isEmpty(), is(equalTo(true))); }
@Test public void testEmptyCommit() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.begin(); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.isEmpty(), is(equalTo(false))); assertThat(testCon2.isEmpty(), is(equalTo(true))); testCon.commit(); testCon2.close(); testCon2 = testRepository.getConnection(); assertThat(testCon.isEmpty(), is(equalTo(false))); assertThat(testCon2.isEmpty(), is(equalTo(false))); }
@Test public void testInferredStatementCount() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); int inferred = getTotalStatementCount(testCon); URI root = vf.createURI("urn:root"); testCon.add(root, RDF.TYPE, RDF.LIST); testCon.remove(root, RDF.TYPE, RDF.LIST); assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(getTotalStatementCount(testCon), is(equalTo(inferred))); }
public void flush() throws RepositoryException { if (autoFlush) return; RepositoryResult<Statement> stmts; if (!added.isEmpty()) { stmts = added.getStatements(null, null, null, false); try { getDelegate().add(stmts); } finally { stmts.close(); } added.clear(); } if (!removed.isEmpty()) { stmts = removed.getStatements(null, null, null, false); try { while (stmts.hasNext()) { getDelegate().remove(stmts.next()); } } finally { stmts.close(); } removed.clear(); } }
@Test public void testRemoveStatements() throws Exception { testCon.begin(); testCon.add(bob, name, nameBob); testCon.add(alice, name, nameAlice); testCon.commit(); assertThat(testCon.hasStatement(bob, name, nameBob, false), is(equalTo(true))); assertThat(testCon.hasStatement(alice, name, nameAlice, false), is(equalTo(true))); testCon.remove(bob, name, nameBob); assertThat(testCon.hasStatement(bob, name, nameBob, false), is(equalTo(false))); assertThat(testCon.hasStatement(alice, name, nameAlice, false), is(equalTo(true))); testCon.remove(alice, null, null); assertThat(testCon.hasStatement(alice, name, nameAlice, false), is(equalTo(false))); assertThat(testCon.isEmpty(), is(equalTo(true))); }
RepositoryConnection conn = repository.getConnection(); try { if (conn.isEmpty()) { URL data = initData.getResourceURL(); conn.add(data, "", RDFFormat
public void testRemoveStatements() throws Exception { testCon.setAutoCommit(false); testCon.add(bob, name, nameBob); testCon.add(alice, name, nameAlice); testCon.setAutoCommit(true); assertTrue(testCon.hasStatement(bob, name, nameBob, false)); assertTrue(testCon.hasStatement(alice, name, nameAlice, false)); testCon.remove(bob, name, nameBob); assertFalse(testCon.hasStatement(bob, name, nameBob, false)); assertTrue(testCon.hasStatement(alice, name, nameAlice, false)); testCon.remove(alice, null, null); assertFalse(testCon.hasStatement(alice, name, nameAlice, false)); assertTrue(testCon.isEmpty()); }
connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) {
connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) {
connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) {