org.openrdf.model.Graph.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(126)

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

Graph.isEmpty介绍

暂无

代码示例

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

@Override
public Void call() throws Exception {
  try {
   final Graph actual = asGraph(m_repo
      .prepareGraphQuery(queryStr));
   assertTrue(!actual.isEmpty());
   return null;
  } catch (Exception e) {
   log.warn("Call failure", e);
   errorCount.incrementAndGet();
   throw e;
  }
}

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

@Test
public void testGraphSerialization()
  throws Exception
{
  testCon.add(bob, name, nameBob);
  testCon.add(alice, name, nameAlice);
  Graph graph;
  RepositoryResult<Statement> statements = testCon.getStatements(null, null, null, true);
  try {
    graph = new LinkedHashModel(Iterations.asList(statements));
  }
  finally {
    statements.close();
  }
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream out = new ObjectOutputStream(baos);
  out.writeObject(graph);
  out.close();
  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  ObjectInputStream in = new ObjectInputStream(bais);
  Graph deserializedGraph = (Graph)in.readObject();
  in.close();
  assertThat(deserializedGraph.isEmpty(), is(equalTo(false)));
  for (Statement st : deserializedGraph) {
    assertThat(graph, hasItem(st));
    assertThat(testCon.hasStatement(st, true), is(equalTo(true)));
  }
}

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

@Override
public Void call() throws Exception {
  try {
   final Graph actual = asGraph(m_repo
      .prepareGraphQuery(queryStr));
   assertTrue(!actual.isEmpty());
   return null;
  } catch (Exception e) {
   log.warn("Call failure", e);
   errorCount.incrementAndGet();
   throw e;
  }
}

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

public void testGraphSerialization()
  throws Exception
{
  testCon.add(bob, name, nameBob);
  testCon.add(alice, name, nameAlice);
  Graph graph;
  RepositoryResult<Statement> statements = testCon.getStatements(null, null, null, true);
  try {
    graph = new GraphImpl(vf, statements.asList());
  }
  finally {
    statements.close();
  }
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream out = new ObjectOutputStream(baos);
  out.writeObject(graph);
  out.close();
  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  ObjectInputStream in = new ObjectInputStream(bais);
  Graph deserializedGraph = (Graph)in.readObject();
  in.close();
  assertFalse(deserializedGraph.isEmpty());
  for (Statement st : deserializedGraph) {
    assertTrue(graph.contains(st));
    assertTrue(testCon.hasStatement(st, true));
  }
}

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

@Test
public void testGraphSerialization()
  throws Exception
{
  testCon.add(bob, name, nameBob);
  testCon.add(alice, name, nameAlice);
  Graph graph;
  RepositoryResult<Statement> statements = testCon.getStatements(null, null, null, true);
  try {
    graph = new LinkedHashModel(Iterations.asList(statements));
  }
  finally {
    statements.close();
  }
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream out = new ObjectOutputStream(baos);
  out.writeObject(graph);
  out.close();
  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  ObjectInputStream in = new ObjectInputStream(bais);
  Graph deserializedGraph = (Graph)in.readObject();
  in.close();
  assertThat(deserializedGraph.isEmpty(), is(equalTo(false)));
  for (Statement st : deserializedGraph) {
    assertThat(graph, hasItem(st));
    assertThat(testCon.hasStatement(st, true), is(equalTo(true)));
  }
}

相关文章