@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() { this.it.close(); }
@Override public void close() { i.close(); } };
@Override protected void closeIterator() { if ( ! isFinished() ) { if ( graphIter != null ) graphIter.close() ; graphIter = null ; } }
@Override public void close() { if (it instanceof ClosableIterator<?>) { ((ClosableIterator<?>)it).close(); } else { Iter.close(it); } } };
@Override public void close() { if (it instanceof ClosableIterator<?>) { ((ClosableIterator<?>)it).close(); } else { Iter.close(it); } } });
/** * 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; }
/** 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 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 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; } /**
/** * @see com.hp.hpl.jena.reasoner.rulesys.RuleContext#contains(com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node, com.hp.hpl.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; }
/** * Internall 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; }
private Node getObject(Node subj, Node pred) { ClosableIterator<Triple> i = graph.find( subj, pred, null ); if( i.hasNext() ) { Triple triple = i.next(); i.close(); return triple.getObject(); } return null; }
/** 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; }
protected Triple getExpression(Node node) { for( BuiltinTerm expressionPredicate : BuiltinTerm.EXPRESSION_PREDICATES ) { ClosableIterator<Triple> i = graph.find( node, expressionPredicate.getNode(), null ); if( i.hasNext() ) { monitor.incrementProgress(); Triple t = i.next(); i.close(); return t; } } return null; }
protected void writePropertiesForSubject(Resource subj, ClosableIterator<Property> iter) { // For each property. for (; iter.hasNext();) { Property property = iter.next(); // Object list writeObjectList(subj, property); if (iter.hasNext()) out.println(" ;"); } iter.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(); } }