@Override public void close() { underlying.close(); }
/** If <code>it</code> is a Closableiterator, close it. Abstracts away from tests [that were] scattered through the code. */ public static void close( Iterator<?> it ) { if (it instanceof ClosableIterator<?>) ((ClosableIterator<?>) it).close(); }
@Override public void close() { underlying.close(); }
/** If <code>it</code> is a Closableiterator, close it. Abstracts away from tests [that were] scattered through the code. */ public static void close( Iterator<?> it ) { if (it instanceof ClosableIterator<?>) ((ClosableIterator<?>) it).close(); }
/** * Return true if the triple pattern is already in either the graph or the stack. * I.e. it has already been deduced. */ @Override public boolean contains(Node s, Node p, Node o) { // Can't use stackCache.contains because that does not do semantic equality ClosableIterator<Triple> it = find(s, p, o); boolean result = it.hasNext(); it.close(); return result; }
/** * Return true if the given pattern occurs somewhere in the find sequence. */ @Override public boolean contains(TriplePattern pattern) { ClosableIterator<Triple> it = find(pattern); boolean result = it.hasNext(); it.close(); return result; } /**
/** * @see org.apache.jena.reasoner.rulesys.RuleContext#contains(org.apache.jena.graph.Node, org.apache.jena.graph.Node, org.apache.jena.graph.Node) */ @Override public boolean contains(Node s, Node p, Node o) { ClosableIterator<Triple> i = find(s, p, o); boolean result = i.hasNext(); i.close(); return result; }
/** * Return true if the triple pattern is already in either the graph or the stack. * I.e. it has already been deduced. */ @Override public boolean contains(Node s, Node p, Node o) { ClosableIterator<Triple> it = find(s, p, o); boolean result = it.hasNext(); it.close(); return result; }
/** Utility method: answer true iff we can find at least one instantiation of the triple in this graph using find(TripleMatch). @param t Triple that is the pattern to match @return true iff find(t) returns at least one result */ final protected boolean containsByFind( Triple t ) { ClosableIterator<Triple> it = find( t ); try { return it.hasNext(); } finally { it.close(); } }
/** * Return true if the given pattern occurs somewhere in the find sequence. */ @Override public boolean contains(TriplePattern pattern) { ClosableIterator<Triple> it = find(pattern); boolean result = it.hasNext(); it.close(); return result; } /**
/** * Return true if the given pattern occurs somewhere in the find sequence. */ @Override public boolean contains(TriplePattern pattern) { ClosableIterator<Triple> it = find(pattern); boolean result = it.hasNext(); it.close(); return result; }
/** * @see org.apache.jena.reasoner.rulesys.RuleContext#contains(org.apache.jena.graph.Node, org.apache.jena.graph.Node, org.apache.jena.graph.Node) */ @Override public boolean contains(Node s, Node p, Node o) { ClosableIterator<Triple> i = find(s, p, o); boolean result = i.hasNext(); i.close(); return result; }
/** Utility method: answer true iff we can find at least one instantiation of the triple in this graph using find(TripleMatch). @param t Triple that is the pattern to match @return true iff find(t) returns at least one result */ final protected boolean containsByFind( Triple t ) { ClosableIterator<Triple> it = find( t ); try { return it.hasNext(); } finally { it.close(); } }
/** * Internal implementation of all the getPropValue variants. */ private static Node doGetPropValue(ClosableIterator<Triple> it) { Node result = null; if (it.hasNext()) { result = it.next().getObject(); } it.close(); return result; }
/** * Internal implementation of all the getPropValue variants. */ private static Node doGetPropValue(ClosableIterator<Triple> it) { Node result = null; if (it.hasNext()) { result = it.next().getObject(); } it.close(); return result; }
/** Answer true if the node has the given type in the graph */ protected static boolean hasType( Node n, EnhGraph g, Resource type ) { // TODO this method doesn't seem to be called anywhere. boolean hasType = false; ClosableIterator<Triple> i = g.asGraph().find( n, RDF.type.asNode(), type.asNode() ); hasType = i.hasNext(); i.close(); return hasType; }
private void wPropertyEltStar(Resource r) { ClosableIterator<Statement> ss = this.listProperties(r); try { while (ss.hasNext()) { Statement s = ss.next(); wPropertyElt(wtype, s.getPredicate(), s, s.getObject()); } } finally { ss.close(); } }
private void wPropertyEltStar(Resource r) { ClosableIterator<Statement> ss = this.listProperties(r); try { while (ss.hasNext()) { Statement s = ss.next(); wPropertyElt(wtype, s.getPredicate(), s, s.getObject()); } } finally { ss.close(); } }
private Triple aTriple() { ClosableIterator<Triple> it = null; try { it = graph.find( null, null, null ); return it.hasNext() ? it.next() : null; } finally { if (it != null) it.close(); } }
Triple findNode( Node s, Node p, Node o ) { ClosableIterator<Triple> it = enhGraph.asGraph().find( s, p, o ); try { return it.hasNext() ? it.next() : null; } finally { it.close(); } }