@Override protected boolean accept(Statement stmt) throws RepositoryException { return !removed.hasStatement(stmt, includeInferred); } };
@Test public void testAddZipFile() throws Exception { testCon.add(RepositoryConnectionTest.class.getResourceAsStream(TEST_DIR_PREFIX + "graphs.zip"), "", RDFFormat.TURTLE); assertTrue(NEWLY_ADDED, testCon.hasStatement(null, publisher, nameBob, false)); assertTrue(NEWLY_ADDED, testCon.hasStatement(null, publisher, nameAlice, false)); assertTrue("alice should be known in the store", testCon.hasStatement(null, name, nameAlice, false)); assertTrue("bob should be known in the store", testCon.hasStatement(null, name, nameBob, false)); }
@Override public boolean containsModel(URI contextURI) { try { return this.connection.hasStatement(null, null, null, false, ConversionUtil.toOpenRDF(contextURI, this.repository.getValueFactory())); } catch(RepositoryException e) { throw new RuntimeException(e); } }
public boolean containsModel(URI contextURI) { try { return this.connection.hasStatement(null, null, null, false, ConversionUtil.toOpenRDF(contextURI, this.repository .getValueFactory())); } catch (RepositoryException e) { throw new RuntimeException(e); } }
@Test public void testClear() throws Exception { testCon.add(bob, name, nameBob); assertThat(testCon.hasStatement(null, name, nameBob, false), is(equalTo(true))); testCon.clear(); assertThat(testCon.hasStatement(null, name, nameBob, false), is(equalTo(false))); }
@Test public void testClearNamed() throws Exception { logger.debug("executing testClearNamed"); String update = "CLEAR NAMED"; Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); operation.execute(); assertFalse(con.hasStatement(null, null, null, false, graph1)); assertFalse(con.hasStatement(null, null, null, false, graph2)); assertTrue(con.hasStatement(null, null, null, false)); }
@Test public void testClearNamed() throws Exception { logger.debug("executing testClearNamed"); String update = "CLEAR NAMED"; Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); operation.execute(); assertFalse(con.hasStatement(null, null, null, false, graph1)); assertFalse(con.hasStatement(null, null, null, false, graph2)); assertTrue(con.hasStatement(null, null, null, false)); }
@Test public void testAutoCommit() throws Exception { testCon.begin(); testCon.add(alice, name, nameAlice); assertTrue("Uncommitted update should be visible to own connection", testCon.hasStatement(alice, name, nameAlice, false)); testCon.commit(); assertTrue("Repository should contain statement after commit", testCon.hasStatement(alice, name, nameAlice, false)); }
@Test public void testClearAll() throws Exception { logger.debug("executing testClearAll"); String update = "CLEAR ALL"; Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); operation.execute(); assertFalse(con.hasStatement(null, null, null, false)); }
@Test public void testRollback() throws Exception { testCon.begin(); testCon.add(alice, name, nameAlice); assertTrue("Uncommitted updates should be visible to own connection", testCon.hasStatement(alice, name, nameAlice, false)); testCon.rollback(); assertFalse("Repository should not contain statement after rollback", testCon.hasStatement(alice, name, nameAlice, false)); }
public void testRollback() throws Exception { testCon.setAutoCommit(false); testCon.add(alice, name, nameAlice); assertTrue("Uncommitted updates should be visible to own connection", testCon.hasStatement(alice, name, nameAlice, false)); testCon.rollback(); assertFalse("Repository should not contain statement after rollback", testCon.hasStatement(alice, name, nameAlice, false)); testCon.setAutoCommit(true); }
@Test public void testAddZipFile() throws Exception { testCon.add(RepositoryConnectionTest.class.getResourceAsStream(TEST_DIR_PREFIX + "graphs.zip"), "", RDFFormat.TURTLE); assertTrue(NEWLY_ADDED, testCon.hasStatement(null, publisher, nameBob, false)); assertTrue(NEWLY_ADDED, testCon.hasStatement(null, publisher, nameAlice, false)); assertTrue("alice should be known in the store", testCon.hasStatement(null, name, nameAlice, false)); assertTrue("bob should be known in the store", testCon.hasStatement(null, name, nameBob, false)); }
@Test public void testAddLiteralWithNewline() throws Exception { Literal test = vf.createLiteral("this is a test\n"); testCon.add(bob, RDFS.LABEL, test); assertTrue(NEWLY_ADDED, testCon.hasStatement(bob, RDFS.LABEL, test, false)); }
public void testInferencerQueryDuringTransaction() throws Exception { testCon.setAutoCommit(false); testCon.add(bob, name, nameBob); assertTrue(testCon.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true)); testCon.setAutoCommit(true); }
public boolean contains(Value subj, Value pred, Value obj, Value... contexts) { try { if (!isResourceURI(subj, pred) || !isEmptyOrResourcePresent(contexts)) return false; return con.hasStatement((Resource) subj, (URI) pred, obj, false, cast(contexts)); } catch (RepositoryException e) { throw new ModelException(e); } }
@Test public void testClear() throws Exception { testCon.add(bob, name, nameBob); assertThat(testCon.hasStatement(null, name, nameBob, false), is(equalTo(true))); testCon.clear(); assertThat(testCon.hasStatement(null, name, nameBob, false), is(equalTo(false))); }
@Test public void testDropNamed() throws Exception { logger.debug("executing testDropNamed"); String update = "DROP NAMED"; Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); operation.execute(); assertFalse(con.hasStatement(null, null, null, false, graph1)); assertFalse(con.hasStatement(null, null, null, false, graph2)); assertTrue(con.hasStatement(null, null, null, false)); }
@Test public void testDropAll() throws Exception { logger.debug("executing testDropAll"); String update = "DROP ALL"; Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); operation.execute(); assertFalse(con.hasStatement(null, null, null, false)); }
@Test public void testRollback() throws Exception { testCon.begin(); testCon.add(alice, name, nameAlice); assertTrue("Uncommitted updates should be visible to own connection", testCon.hasStatement(alice, name, nameAlice, false)); testCon.rollback(); assertFalse("Repository should not contain statement after rollback", testCon.hasStatement(alice, name, nameAlice, false)); }
@Test public void testClearAll() throws Exception { logger.debug("executing testClearAll"); String update = "CLEAR ALL"; Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); operation.execute(); assertFalse(con.hasStatement(null, null, null, false)); }