private Triple[] iteratorAsTriples(ClosableIterator<Long[]> iterator) {
try {
List<Triple> triples = new ArrayList<Triple>();
while (iterator.hasNext()) {
Long[] longs = iterator.next();
Triple triple = new TripleImpl((SubjectNode) nodePool.getNodeById(longs[0]),
(PredicateNode) nodePool.getNodeById(longs[1]), (ObjectNode) nodePool.getNodeById(longs[2]));
triples.add(triple);
}
Triple[] tripleArray = new Triple[triples.size()];
return triples.toArray(tripleArray);