@Override public T next() { T x = i.next(); try { seen.add( x ); } catch (OutOfMemoryError e) { throw e; } return x; }
@Override public T next() { T x = i.next(); try { seen.add( x ); } catch (OutOfMemoryError e) { throw e; } return x; }
/** * 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(); }
private Node getObject(final Node subj, final Node pred) { final ClosableIterator<Triple> i = _graph.find(subj, pred, null); if (i.hasNext()) { final Triple triple = i.next(); i.close(); return triple.getObject(); } return null; }
private Node getObject(final Node subj, final Node pred) { final ClosableIterator<Triple> i = _graph.find(subj, pred, null); if (i.hasNext()) { final Triple triple = i.next(); i.close(); return triple.getObject(); } return null; }
private Node getObject(final Node subj, final Node pred) { final ClosableIterator<Triple> i = _graph.find(subj, pred, null); if (i.hasNext()) { final Triple triple = i.next(); i.close(); return triple.getObject(); } 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; } /**
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; } /**
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(); }
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(); } }
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(); } }
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(); } }
static List<String> getAll(Resource r, Property p) { List<String> l = new ArrayList<>() ; ClosableIterator<Statement> cIter = r.listProperties(p) ; for ( ; cIter.hasNext() ; ) { Statement stmt = cIter.next() ; String df = stmt.getObject().asResource().getURI() ; l.add(df) ; } cIter.close() ; return l ; }
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(); } }
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(); } }