@Override protected boolean hasNextBinding() { boolean isMore = graphIter.hasNext() ; return isMore ; }
@Override public boolean hasNext() { return i.hasNext(); }
/** * 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; }
@Override public boolean hasNext() { assert this.modelImplJena.getModificationCount() == this.modelModificationCountAtCreationTime : "concurrent modification for iterator (" + this.modelModificationCountAtCreationTime + " but model is " + this.modelImplJena.getModificationCount() + ")"; return this.it.hasNext(); }
/** 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; } /**
/** * @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; }
/** * 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; }
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(); }
/** * 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 boolean allPropsAreAttr(Resource r) { ClosableIterator<Statement> ss = listProperties(r); Set<Property> seen = new HashSet<Property>(); try { while (ss.hasNext()) { Statement s = ss.next(); if (!canBeAttribute(s, seen)) return false; } } finally { ss.close(); } return true; }
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; }
@Override public boolean graphBaseContains( Triple t ) { if ( t.isConcrete() ) return triples.contains( t ) ; ClosableIterator<Triple> it = find( t ); try { for ( ; it.hasNext() ; ) { Triple t2 = it.next() ; if ( tripleContained(t, t2) ) return true ; } } finally { it.close(); } return false ; }
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; }
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; } /**
/** 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(); } }