@Override public boolean hasNext() { if (wrappedIterator.hasNext()) return true; if (sizeCache == null) sizeCache = count; openIterators.remove(wrappedIterator); return false; } @Override
/** * 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; }
/** * 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 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(); } }
/** 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; } /**
/** * 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; }
private Iterator<Node> listTypes() { Set<Node> types = CollectionFactory.createHashedSet(); ClosableIterator<Triple> it = graph.find( null, RDF.type.asNode(), null ); while (it.hasNext()) types.add( it.next().getObject() ); return types.iterator(); }
private Iterator<Node> listTypes() { Set<Node> types = CollectionFactory.createHashedSet(); ClosableIterator<Triple> it = graph.find( null, RDF.type.asNode(), null ); while (it.hasNext()) types.add( it.next().getObject() ); return types.iterator(); }
/** 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; }
static public int hashCode(Graph g) { ClosableIterator<Triple> ci = GraphUtil.findAll( g ); int hash = 0; GraphMatcher gm = new GraphMatcher(g); while ( ci.hasNext() ) { Triple t = ci.next(); hash += gm.new AnonStatement(t).myHashCode(null); } return hash; } /**
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(); } }