use of net.fortytwo.sesametools.CompoundCloseableIteration in project blueprints by tinkerpop.
the class GraphSailConnection method getStatementsInternal.
public CloseableIteration<? extends Statement, SailException> getStatementsInternal(final Resource subject, final URI predicate, final Value object, final boolean includeInferred, final Resource... contexts) throws SailException {
int index = 0;
if (null != subject) {
index |= 0x1;
}
if (null != predicate) {
index |= 0x2;
}
if (null != object) {
index |= 0x4;
}
if (0 == contexts.length) {
return createIteration(store.matchers[index].match(subject, predicate, object, null, includeInferred));
} else {
Collection<CloseableIteration<Statement, SailException>> iterations = new LinkedList<CloseableIteration<Statement, SailException>>();
// TODO: as an optimization, filter on multiple contexts simultaneously (when context is not used in the matcher), rather than trying each context consecutively.
for (Resource context : contexts) {
index |= 0x8;
Matcher m = store.matchers[index];
iterations.add(createIteration(m.match(subject, predicate, object, context, includeInferred)));
}
return new CompoundCloseableIteration<Statement, SailException>(iterations);
}
}
Aggregations