org.openrdf.repository.RepositoryConnection.size()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中org.openrdf.repository.RepositoryConnection.size方法的一些代码示例,展示了RepositoryConnection.size的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryConnection.size方法的具体详情如下:
包路径:org.openrdf.repository.RepositoryConnection
类名称:RepositoryConnection
方法名:size

RepositoryConnection.size介绍

暂无

代码示例

代码示例来源:origin: net.fortytwo.sesametools/repository-sail

protected long sizeInternal(Resource... contexts) throws SailException {
  try {
    return repoConnection.size();
  } catch (RepositoryException e) {
    throw new SailException(e);
  }
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-rules

@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);
  }
}

代码示例来源:origin: net.fortytwo.sesametools/common

@Override
public int size() {
  try {
    return (int) rc.size();
  } catch (RepositoryException e) {
    throw new RepositoryGraphRuntimeException(e);
  }
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-model

public synchronized int size() {
  if (size < 0) {
    try {
      return size = (int) con.size();
    } catch (RepositoryException e) {
      throw new ModelException(e);
    }
  }
  return size;
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-rules

@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);
  }
}

代码示例来源:origin: org.openrdf.elmo/elmo-repository

@Override
public long size(Resource... contexts) throws RepositoryException {
  if (isDelegatingRead())
    return super.size();
  long size = super.size(contexts);
  long rsize = removed.size(contexts);
  long asize = added.size(contexts);
  return size - rsize + asize;
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

@Override
public long size() throws ModelRuntimeException {
  assertModel();
  try {
    return this.connection.size(this.openRdfContext);
  } catch(RepositoryException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

@Override
public long size()
  throws ModelRuntimeException
{
  assertModel();
  try {
    return connection.size(openRdfContext);
  }
  catch (RepositoryException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-model

@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();
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

@Override
public long size() throws ModelRuntimeException {
  this.assertModel();
  try {
    return this.connection.size();
  } catch(RepositoryException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

public long size() throws ModelRuntimeException {
  this.assertModel();
  try {
    return this.connection.size();
  } catch (RepositoryException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: blazegraph/database

@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)));
}

代码示例来源:origin: org.apache.marmotta/marmotta-core

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;
  }
}

代码示例来源:origin: blazegraph/database

@Test
public void testUpdateBaseURI()
  throws Exception
{
  testCon.prepareUpdate(QueryLanguage.SPARQL, "INSERT DATA { <> a <> }", URN_TEST_S1).execute();
  assertThat(testCon.size(), is(equalTo(1L)));
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-compliance-base

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());
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-compliance-base

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());
}

代码示例来源:origin: blazegraph/database

@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)));
}

代码示例来源:origin: blazegraph/database

@Test
public void testUpdateBaseURI()
  throws Exception
{
  testCon.prepareUpdate(QueryLanguage.SPARQL, "INSERT DATA { <> a <> }", URN_TEST_S1).execute();
  assertThat(testCon.size(), is(equalTo(1L)));
}

代码示例来源:origin: org.openrdf.elmo/elmo-repository

@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();
}

代码示例来源:origin: apache/marmotta

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();
  }
}

相关文章

微信公众号

最新文章

更多