@Override public void execute() throws UpdateExecutionException { try { update.evaluate(); } catch (Exception ex) { throw new UpdateExecutionException(ex); } }
@Override protected void doApplyToNamespace(final RemoteRepository repo, final UUID uuid) throws Exception { repo.prepareUpdate(updateStr, uuid).evaluate(); }
private void dropGraph(final String namespace) throws Exception { final RemoteRepository rr = m_mgr.getRepositoryForNamespace(namespace); // force an abort by preparing an invalid update rr.prepareUpdate("DROP GRAPH <" + namespace + ">").evaluate(); }
private void forceAbort(final String namespace) throws Exception { final RemoteRepository rr = m_mgr.getRepositoryForNamespace(namespace); // force an abort by preparing an invalid update rr.prepareUpdate("FORCE ABORT").evaluate(); }
public void testLoad() throws Exception { final URL url = this.getClass().getClassLoader().getResource("com/bigdata/rdf/rio/small.rdf"); final String update = "LOAD <" + url.toExternalForm() + ">"; final String ns = "http://bigdata.com/test/data#"; m_repo.prepareUpdate(update).evaluate(); assertTrue(hasStatement(f.createURI(ns, "mike"), RDFS.LABEL, f.createLiteral("Michael Personick"), true)); }
public void testClearAll() throws Exception { // log.debug("executing testClearAll"); String update = "CLEAR ALL"; // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); // // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertFalse(hasStatement(null, null, null, false)); }
public void testDropAll() throws Exception { // log.debug("executing testDropAll"); String update = "DROP ALL"; // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update); // // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertFalse(hasStatement(null, null, null, false)); }
/** * Verify ability to load data from a gzip resource. */ public void testLoadGZip() throws Exception { final URL url = this.getClass().getClassLoader().getResource("com/bigdata/rdf/rio/small.rdf.gz"); final String update = "LOAD <" + url.toExternalForm() + ">"; final String ns = "http://bigdata.com/test/data#"; m_repo.prepareUpdate(update).evaluate(); assertTrue(hasStatement(f.createURI(ns, "mike"), RDFS.LABEL, f.createLiteral("Michael Personick"), true)); }
public void testReallyLongQueryString() throws Exception { final Literal l = getReallyLongLiteral(1000); log.debug("executing test testInsertEmptyWhere"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("INSERT { <" + bob + "> rdfs:label " + l + " . } WHERE { }"); assertFalse(hasStatement(bob, RDFS.LABEL, l, true)); m_repo.prepareUpdate(update.toString()).evaluate(); assertTrue(hasStatement(bob, RDFS.LABEL, l, true)); }
public void testDeleteData() throws Exception { // log.debug("executing testDeleteData"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("DELETE DATA { ex:alice foaf:knows ex:bob. } "); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); assertTrue(hasStatement(alice, FOAF.KNOWS, bob, true)); // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); String msg = "statement should have been deleted."; assertFalse(msg, hasStatement(alice, FOAF.KNOWS, bob, true)); }
public void testDeleteDataFromGraph() throws Exception { // log.debug("executing testDeleteDataFromGraph"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("DELETE DATA { GRAPH ex:graph1 {ex:alice foaf:knows ex:bob. } } "); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); assertTrue(hasStatement(alice, FOAF.KNOWS, bob, true, graph1)); // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); String msg = "statement should have been deleted from graph1"; assertFalse(msg, hasStatement(alice, FOAF.KNOWS, bob, true, graph1)); }
@Override protected void doApplyToNamespace(final RemoteRepository repo, final UUID uuid) throws Exception { repo.prepareUpdate(updateStr, uuid).evaluate(); }
public void testCopyToNewNamed() throws Exception { // log.debug("executing testCopyToNewNamed"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("COPY GRAPH ex:graph1 TO ex:graph3"); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); // // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertTrue(hasStatement(bob, FOAF.NAME, null, false, f.createURI(EX_NS, "graph3"))); assertTrue(hasStatement(bob, FOAF.NAME, null, false, graph1)); }
public void testAddToNewNamed() throws Exception { // log.debug("executing testAddToNewNamed"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("ADD GRAPH ex:graph1 TO ex:graph3"); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); // // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertTrue(hasStatement(bob, FOAF.NAME, null, false, f.createURI(EX_NS, "graph3"))); assertTrue(hasStatement(bob, FOAF.NAME, null, false, graph1)); }
public void testMoveToNewNamed() throws Exception { // log.debug("executing testMoveToNewNamed"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("MOVE GRAPH ex:graph1 TO ex:graph3"); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); // // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertTrue(hasStatement(bob, FOAF.NAME, null, false, f.createURI(EX_NS, "graph3"))); assertFalse(hasStatement(null, null, null, false, graph1)); }
protected void executeInsert(String where, boolean expected) throws RepositoryException, Exception { final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("INSERT { ex:bob rdfs:label \"Bob\" . } WHERE { " + where +" }"); assertFalse(hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true)); m_repo.prepareUpdate(update.toString()).evaluate(); assertEquals(expected, hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true)); }
public void testCopyToExistingNamed() throws Exception { // log.debug("executing testCopyToExistingNamed"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("COPY GRAPH ex:graph1 TO ex:graph2"); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertTrue(hasStatement(bob, FOAF.NAME, null, false, graph2)); assertFalse(hasStatement(alice, FOAF.NAME, null, false, graph2)); assertTrue(hasStatement(bob, FOAF.NAME, null, false, graph1)); }
public void testCopyFromDefaultToDefault() throws Exception { // log.debug("executing testCopyFromDefaultToDefault"); final StringBuilder update = new StringBuilder(); update.append(getNamespaceDeclarations()); update.append("COPY DEFAULT TO DEFAULT"); // Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString()); assertTrue(hasStatement(graph1, DC.PUBLISHER, null, false, (Resource)null)); assertTrue(hasStatement(graph2, DC.PUBLISHER, null, false, (Resource)null)); // operation.execute(); m_repo.prepareUpdate(update.toString()).evaluate(); assertTrue(hasStatement(graph1, DC.PUBLISHER, null, false, (Resource)null)); assertTrue(hasStatement(graph2, DC.PUBLISHER, null, false, (Resource)null)); }
private void forceAbort(final String namespace) throws Exception { final RemoteRepository rr = m_mgr.getRepositoryForNamespace(namespace); // force an abort by preparing an invalid update rr.prepareUpdate("FORCE ABORT").evaluate(); }
private void dropGraph(final String namespace) throws Exception { final RemoteRepository rr = m_mgr.getRepositoryForNamespace(namespace); // force an abort by preparing an invalid update rr.prepareUpdate("DROP GRAPH <" + namespace + ">").evaluate(); }