-// DirectPredicates.queryEach(graph, r, processor, entry, null, new IntProcedure() {
-//
-// @Override
-// public void execute(ReadGraphImpl graph, final int pred) throws DatabaseException {
-// result.add(pred);
-// }
-//
-// @Override
-// public void finished(ReadGraphImpl graph) throws DatabaseException {
-//
-//
-// }
-//
-// @Override
-// public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException {
-// procedure.exception(graph, t);
-// }
-//
-// });
-
- if(entry != null) {
- entry.setResult(result);
- entry.setReady();
- }
+ if(result.isEmpty()) {
+
+ if(entry != null) {
+ entry.setResult(direct);
+ entry.setReady();
+ }
+
+ procedure.execute(graph, direct);
+
+ } else {
+
+ direct.forEach(new TIntProcedure() {
+ @Override
+ public boolean execute(int value) {
+ result.add(value);
+ return true;
+ }
+ });
+
+ if(entry != null) {
+ entry.setResult(result);
+ entry.setReady();
+ }
+
+ procedure.execute(graph, result);
+
+ }