protected void abort() { if (null != evaluator) { evaluator.stop(); } } }
public void push(final Object... nextValues) throws RippleException { System.out.println("pushing new values:"); for (Object v : nextValues) { System.out.println("\t" + v); } Collector<RippleList> prevCollector = undoRedoStack.currentState(); if (0 == prevCollector.size()) { // note: this modifies evaluation history, harmlessly prevCollector.accept(SesameList.nilList()); } Collector<RippleList> nextCollector = new Collector<>(); System.out.println("\tbefore evaluation:"); for (RippleList l : prevCollector) { RippleList cur = l; for (Object v : nextValues) { cur = cur.push(v); } System.out.println("\t\t" + cur); evaluator.apply(cur, nextCollector, connection); } System.out.println("\tafter evaluation:"); for (RippleList l : nextCollector) { System.out.println("\t\t" + l); } undoRedoStack.done(nextCollector); }
public void apply(final RippleList arg, final Sink<RippleList> solutions, final ModelConnection mc) throws RippleException { // FIXME: cheat to temporarily disable asynchronous query answering boolean a = Ripple.asynchronousQueries(); Ripple.enableAsynchronousQueries(false); try { Collector<RippleList> s = new Collector<>(); StackEvaluator e = new LazyStackEvaluator(); e.apply(arg, s, mc); List<RippleList> all = s.stream().collect(Collectors.toCollection(() -> new LinkedList<>())); Collections.sort(all, mc.getComparator()); for (RippleList l : all) { solutions.accept(l); } } finally { Ripple.enableAsynchronousQueries(a); } } }
public void execute(final QueryEngine qe, final ModelConnection mc) throws RippleException { final Collector<RippleList> expressions = new Collector<>(); final Sink<RippleList> exprSink = l -> { // Note: the first element of the list will also be a list final RippleList stack = ((RippleList) l.getFirst()).invert(); expressions.accept(stack); }; query.evaluate(exprSink, qe, mc); evaluator = qe.getEvaluator(); final Sink<RippleList> evaluatorSink = l -> evaluator.apply(l, sink, mc); expressions.writeTo(evaluatorSink); }
public void apply(final RippleList arg, final Sink<RippleList> solutions, final ModelConnection mc) throws RippleException { // FIXME: cheat to temporarily disable asynchronous query answering boolean a = Ripple.asynchronousQueries(); Ripple.enableAsynchronousQueries(false); try { Collector<RippleList> s = new Collector<>(); StackEvaluator e = new LazyStackEvaluator(); e.apply(arg.push(Operator.OP), s, mc); int count = s.size(); solutions.accept( arg.getRest().push(count)); } finally { Ripple.enableAsynchronousQueries(a); } } }