protected long sizeInternal(Resource... contexts) throws SailException { try { return repoConnection.size(); } catch (RepositoryException e) { throw new SailException(e); } }
@Override protected boolean doRemove(@Nullable final Resource subj, @Nullable final URI pred, @Nullable final Value obj, final Resource[] ctxs) { try { final long size = this.connection.size(); this.connection.remove(subj, pred, obj, ctxs); return this.connection.size() != size; } catch (final RepositoryException ex) { throw new ModelException(ex); } }
@Override public int size() { try { return (int) rc.size(); } catch (RepositoryException e) { throw new RepositoryGraphRuntimeException(e); } }
public synchronized int size() { if (size < 0) { try { return size = (int) con.size(); } catch (RepositoryException e) { throw new ModelException(e); } } return size; }
@Override protected boolean doAdd(@Nullable final Resource subj, @Nullable final URI pred, @Nullable final Value obj, final Resource[] ctxs) { try { final long size = this.connection.size(); this.connection.add(subj, pred, obj, ctxs); return this.connection.size() != size; } catch (final RepositoryException ex) { throw new ModelException(ex); } }
@Override public long size() throws ModelRuntimeException { assertModel(); try { return this.connection.size(this.openRdfContext); } catch(RepositoryException e) { throw new ModelRuntimeException(e); } }
@Override public long size() throws ModelRuntimeException { assertModel(); try { return connection.size(openRdfContext); } catch (RepositoryException e) { throw new ModelRuntimeException(e); } }
@Override public int size() { if (subj == null && pred == null && obj == null) { try { return (int) con.size(cast(contexts)); } catch (RepositoryException e) { throw new ModelException(e); } } return super.size(); }
@Override public long size() throws ModelRuntimeException { this.assertModel(); try { return this.connection.size(); } catch(RepositoryException e) { throw new ModelRuntimeException(e); } }
public long size() throws ModelRuntimeException { this.assertModel(); try { return this.connection.size(); } catch (RepositoryException e) { throw new ModelRuntimeException(e); } }
@Test public void testSizeRollback() throws Exception { assertThat(testCon.size(), is(equalTo(0L))); assertThat(testCon2.size(), is(equalTo(0L))); testCon.begin(); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.size(), is(equalTo(1L))); assertThat(testCon2.size(), is(equalTo(0L))); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.size(), is(equalTo(2L))); assertThat(testCon2.size(), is(equalTo(0L))); testCon.rollback(); assertThat(testCon.size(), is(equalTo(0L))); assertThat(testCon2.size(), is(equalTo(0L))); }
public void setSesameStatus(RepositoryConnection repositoryConnection) throws RepositoryException { final Repository repository = repositoryConnection.getRepository(); tripleStore.clear(); switch (detailLevel) { case 2: tripleStore.put("statements", String.valueOf(repositoryConnection.size())); tripleStore.put("namespaces", String.valueOf(sizeOf(repositoryConnection.getNamespaces()))); tripleStore.put("contexts", String.valueOf(sizeOf(repositoryConnection.getContextIDs()))); case 1: tripleStore.put("writeable", String.valueOf(repository.isWritable())); break; case 0: default: //nop; } }
@Test public void testUpdateBaseURI() throws Exception { testCon.prepareUpdate(QueryLanguage.SPARQL, "INSERT DATA { <> a <> }", URN_TEST_S1).execute(); assertThat(testCon.size(), is(equalTo(1L))); }
public void testSizeCommit() throws Exception { assertEquals(0, testCon.size()); assertEquals(0, testCon2.size()); testCon.setAutoCommit(false); testCon.add(vf.createBNode(), vf.createURI("urn:pred"), vf.createBNode()); assertEquals(1, testCon.size()); assertEquals(0, testCon2.size()); testCon.add(vf.createBNode(), vf.createURI("urn:pred"), vf.createBNode()); assertEquals(2, testCon.size()); assertEquals(0, testCon2.size()); testCon.commit(); assertEquals(2, testCon.size()); assertEquals(2, testCon2.size()); }
public void testSizeRollback() throws Exception { assertEquals(0, testCon.size()); assertEquals(0, testCon2.size()); testCon.setAutoCommit(false); testCon.add(vf.createBNode(), vf.createURI("urn:pred"), vf.createBNode()); assertEquals(1, testCon.size()); assertEquals(0, testCon2.size()); testCon.add(vf.createBNode(), vf.createURI("urn:pred"), vf.createBNode()); assertEquals(2, testCon.size()); assertEquals(0, testCon2.size()); testCon.rollback(); assertEquals(0, testCon.size()); assertEquals(0, testCon2.size()); }
@Test public void testSizeRollback() throws Exception { assertThat(testCon.size(), is(equalTo(0L))); assertThat(testCon2.size(), is(equalTo(0L))); testCon.begin(); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.size(), is(equalTo(1L))); assertThat(testCon2.size(), is(equalTo(0L))); testCon.add(vf.createBNode(), vf.createURI(URN_PRED), vf.createBNode()); assertThat(testCon.size(), is(equalTo(2L))); assertThat(testCon2.size(), is(equalTo(0L))); testCon.rollback(); assertThat(testCon.size(), is(equalTo(0L))); assertThat(testCon2.size(), is(equalTo(0L))); }
@Test public void testUpdateBaseURI() throws Exception { testCon.prepareUpdate(QueryLanguage.SPARQL, "INSERT DATA { <> a <> }", URN_TEST_S1).execute(); assertThat(testCon.size(), is(equalTo(1L))); }
@Override public boolean isEmpty() throws RepositoryException { if (isDelegatingRead()) return super.isEmpty(); if (!added.isEmpty()) return false; if (super.isEmpty()) return true; if (removed.isEmpty()) return false; if (super.size() > removed.size()) return false; return super.isEmpty(); }
protected void testResource(String uri) throws Exception { Assume.assumeTrue("LDClient endpoint for <" + uri + "> not available", ldclient.ping(uri)); ClientResponse response = ldclient.retrieveResource(uri); RepositoryConnection connection = ModelCommons.asRepository(response.getData()).getConnection(); try { connection.begin(); Assert.assertTrue(connection.size() > 0); }finally { connection.commit(); connection.close(); } }