@Test public void testHasStatement() { graph.add(statements); assertFalse(graph.hasStatement(null)); assertTrue(graph.hasStatement(new StatementImpl(doc2, isBasedOn, doc1))); assertFalse(graph.hasStatement(new StatementImpl(doc2, isBasedOn, doc2))); assertTrue(graph.hasStatement(new StatementImpl(doc2, isBasedOn, null))); assertFalse(graph.hasStatement(new StatementImpl(null, null, doc2))); }
@Override public boolean hasStatement(Statement statement) { if (statement == null) { return false; } Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); SimpleSelector selector = getJenaSelector(graph, statement); return graph.contains(selector.getSubject(), selector.getPredicate(), selector.getObject()); } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }
JenaGraph implements Graph { @Override public boolean hasStatement(Statement statement) { if (statement == null) { return false; } Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); SimpleSelector selector = getJenaSelector(graph, statement); return graph.contains(selector.getSubject(), selector.getPredicate(), selector.getObject()); } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } } }
JenaGraph implements Graph { @Override public boolean hasStatement(Statement statement) { if (statement == null) { return false; } Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); SimpleSelector selector = getJenaSelector(graph, statement); return graph.contains(selector.getSubject(), selector.getPredicate(), selector.getObject()); } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }  }
JenaGraph implements Graph { @Override public boolean hasStatement(Statement statement) { if (statement == null) { return false; } Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); SimpleSelector selector = getJenaSelector(graph, statement); return graph.contains(selector.getSubject(), selector.getPredicate(), selector.getObject()); } 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 boolean hasStatement(Statement statement) { if (statement == null) { return false; } Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); SimpleSelector selector = getJenaSelector(graph, statement); return graph.contains(selector.getSubject(), selector.getPredicate(), selector.getObject()); } 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);  }