org.apache.commons.rdf.api.Graph.clear()方法的使用及代码示例

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

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

Graph.clear介绍

[英]Clear the graph, removing all triples.
[中]清除图形,删除所有三元组。

代码示例

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test(expected = IllegalStateException.class)
public void clearNotSupported() throws Exception {
  graph.clear();
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void clear() throws Exception {
  graph.clear();
  assertFalse(graph.contains(alice, knows, bob));
  assertEquals(0, graph.size());
  graph.clear(); // no-op
  assertEquals(0, graph.size());
}

代码示例来源:origin: commons-rdf/commons-rdf

@Test
public void clear() throws Exception {
  graph.clear();
  assertFalse(graph.contains(alice, knows, bob));
  assertEquals(0, graph.size());
  graph.clear(); // no-op
  assertEquals(0, graph.size());
}

代码示例来源:origin: trellis-ldp/trellis

@BeforeEach
public void setUp() {
  final IRI other = rdf.createIRI("trellis:data/other");
  graph.clear();
  graph.add(rdf.createTriple(subject, ACL.agent, rdf.createIRI("info:agent/foo")));
  graph.add(rdf.createTriple(subject, ACL.agent, rdf.createIRI("info:agent/bar")));
  graph.add(rdf.createTriple(other, ACL.agent, rdf.createIRI("info:agent/baz")));
  graph.add(rdf.createTriple(subject, ACL.agentClass, rdf.createIRI("info:agent/SomeClass")));
  graph.add(rdf.createTriple(other, ACL.agentClass, rdf.createIRI("info:agent/SomeOtherClass")));
  graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group1")));
  graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group2")));
  graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group3")));
  graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group4")));
  graph.add(rdf.createTriple(subject, ACL.mode, ACL.Read));
  graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:data/resource2")));
  graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:data/resource3")));
  graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:data/resource4")));
  graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:data/resource4")));
  graph.add(rdf.createTriple(other, ACL.accessTo, rdf.createIRI("trellis:data/resource5")));
  graph.add(rdf.createTriple(subject, ACL.accessToClass, PROV.Activity));
  graph.add(rdf.createTriple(other, ACL.accessToClass, PROV.Entity));
  graph.add(rdf.createTriple(subject, ACL.default_, rdf.createIRI("trellis:data/container")));
}

相关文章