@Test public void testClear() { assertSame(0L, graph.size()); graph.add(statements); assertSame(3L, graph.size()); graph.clear(); assertSame(0L, graph.size()); }
@Override public void clear() { Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); graph.removeAll(); RSIterator it = graph.listReifiedStatements(); List<ReifiedStatement> rss = new ArrayList<>(); while (it.hasNext()) { rss.add(it.nextRS()); } for (ReifiedStatement rs : rss) { graph.removeReification(rs); } } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }
JenaGraph implements Graph { @Override public void clear() { Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); graph.removeAll(); RSIterator it = graph.listReifiedStatements(); List<ReifiedStatement> rss = new ArrayList<>(); while (it.hasNext()) { rss.add(it.nextRS()); } for (ReifiedStatement rs : rss) { graph.removeReification(rs); } } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } } }
JenaGraph implements Graph { @Override public void clear() { Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); graph.removeAll(); RSIterator it = graph.listReifiedStatements(); List<ReifiedStatement> rss = new ArrayList<>(); while (it.hasNext()) { rss.add(it.nextRS()); } for (ReifiedStatement rs : rss) { graph.removeReification(rs); } } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }  }
JenaGraph implements Graph { @Override public void clear() { Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); graph.removeAll(); RSIterator it = graph.listReifiedStatements(); List<ReifiedStatement> rss = new ArrayList<>(); while (it.hasNext()) { rss.add(it.nextRS()); } for (ReifiedStatement rs : rss) { graph.removeReification(rs); } } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }  @Override void setDescription(GraphDescription graphDescription); void setNamespaces(Map<String, String> namespaces); @Override Map<String, String> getNamespaces(); @Override void add(Statement statement); @Override void add(List<Statement> statements); @Override void remove(Statement statement); @Override void remove(List<Statement> statements); @Override List<Statement> getStatements(); @Override List<Statement> getStatements(Node subject, Node predicate, Node object); @Override List<Statement> getStatements(Statement statement); @Override List<Node> getSubjects(Node predicate, Node object); @Override List<Node> getPredicates(Node subject, Node object); @Override List<Node> getObjects(Node subject, Node predicate); @Override boolean hasStatement(Statement statement); @Override boolean hasResource(Resource resource); @Override Long size(); @Override void clear(); @Override QueryResult query(String queryString, String language, String baseURI); @Override int queryCount(String queryString, String language, String baseURI); @Override boolean read(InputStream in, String lang, String base); @Override boolean read(String path, String lang, String base); @Override boolean write(OutputStream out, String lang, String base); @Override boolean write(String path, String lang, String base); }
JenaGraph implements Graph { @Override public void clear() { Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); graph.removeAll(); RSIterator it = graph.listReifiedStatements(); List<ReifiedStatement> rss = new ArrayList<>(); while (it.hasNext()) { rss.add(it.nextRS()); } for (ReifiedStatement rs : rss) { graph.removeReification(rs); } } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }  @Override void setDescription(GraphDescription graphDescription); void setNamespaces(Map<String, String> namespaces); @Override Map<String, String> getNamespaces(); @Override void add(Statement statement); @Override void add(List<Statement> statements); @Override void remove(Statement statement); @Override void remove(List<Statement> statements); @Override List<Statement> getStatements(); @Override List<Statement> getStatements(Node subject, Node predicate, Node object); @Override List<Statement> getStatements(Statement statement); @Override List<Node> getSubjects(Node predicate, Node object); @Override List<Node> getPredicates(Node subject, Node object); @Override List<Node> getObjects(Node subject, Node predicate); @Override boolean hasStatement(Statement statement); @Override boolean hasResource(Resource resource); @Override Long size(); @Override void clear(); @Override QueryResult query(String queryString, String language, String baseURI); @Override int queryCount(String queryString, String language, String baseURI); @Override boolean read(InputStream in, String lang, String base); @Override boolean read(String path, String lang, String base); @Override boolean write(OutputStream out, String lang, String base); @Override boolean write(String path, String lang, String base);  }