public Graph description() {
if (executed) return result;
executed = true;
final QueryIterConcat qIter = new QueryIterConcat(context);
Pingback<?> pingback = null;
if (timeout > 0) {
pingback = AlarmClock.get().add(new Callback<Object>() {
public void proc(Object ignore) {
qIter.cancel();
}
}, timeout);
}
FindQuery outgoing = new FindQuery(
Triple.create(node, Node.ANY, Node.ANY),
mapping.compiledPropertyBridges(), limit, context);
qIter.add(outgoing.iterator());
if (!onlyOutgoing) {
FindQuery incoming = new FindQuery(
Triple.create(Node.ANY, Node.ANY, node),
mapping.compiledPropertyBridges(), limit, context);
qIter.add(incoming.iterator());
FindQuery triples = new FindQuery(
Triple.create(Node.ANY, node, Node.ANY),
mapping.compiledPropertyBridges(), limit, context);
qIter.add(triples.iterator());
}
result.getBulkUpdateHandler().add(TripleQueryIter.create(qIter));
if (pingback != null) {
AlarmClock.get().cancel(pingback);