public QueryEngine(final Model model, final PrintStream out, final PrintStream err) throws RippleException { this(model, new LazyStackEvaluator(), out, err); }
public QueryEngine(final Model model) throws RippleException { this(model, new LazyStackEvaluator(), System.out, System.err); }
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 RippleScriptEngine(final ScriptEngineFactory factory) throws RippleException { this.factory = factory; results = new Collector<>(); URIMap uriMap = new URIMap(); SailConfiguration sailConfig = new SailConfiguration(uriMap); // TODO: shutDown on failure model = new SesameModel(sailConfig.getSail()); StackEvaluator eval = new LazyStackEvaluator(); QueryEngine queryEngine = new QueryEngine(model, eval, System.out, System.err); queryPipe = new QueryPipe(queryEngine, results); }
public RippleSession() throws RippleException { this.undoRedoStack = new UndoRedoStack<>(UNDO_REDO_DEPTH); undoRedoStack.done(new Collector<>()); sail = new MemoryStore(); try { sail.initialize(); } catch (SailException e) { throw new RippleException(e); } Model model = new SesameModel(sail); evaluator = new LazyStackEvaluator(); QueryEngine queryEngine = new QueryEngine(model, evaluator, System.out, System.err); connection = queryEngine.getConnection(); }
private static void demo(final InputStream in, final PrintStream out, final PrintStream err) throws RippleException { // Create a Sesame triple store. URIMap uriMap = new URIMap(); SailConfiguration sailConfig = new SailConfiguration(uriMap); Sail sail = sailConfig.getSail(); // Attach a Ripple model to the repository. Model model = new SesameModel(sail); // Attach a query engine to the model. StackEvaluator evaluator = new LazyStackEvaluator(); QueryEngine qe = new QueryEngine(model, evaluator, out, err); // Attach an interpreter to the query engine and let it query from // standard input. RippleCommandLine r = new RippleCommandLine(qe, in); r.run(); // Shut down. model.shutDown(); }
private static void demo(final InputStream in, final PrintStream out, final PrintStream err) throws RippleException { // Create a Sesame triple store. URIMap uriMap = new URIMap(); SailConfiguration sailConfig = new SailConfiguration(uriMap); Sail sail = sailConfig.getSail(); // Attach a Ripple model to the repository. Model model = new SesameModel(sail); // Attach a query engine to the model. StackEvaluator evaluator = new LazyStackEvaluator(); QueryEngine qe = new QueryEngine(model, evaluator, out, err); // Attach an interpreter to the query engine and let it query from // standard input. RippleCommandLine r = new RippleCommandLine(qe, in); r.run(); // Shut down. model.shutDown(); }
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); } } }
@Test public void testFuzz() throws Exception { Model model = getTestModel(); StackEvaluator eval = new LazyStackEvaluator();
@Test public void testQueries() throws Exception { Model model = getTestModel(); StackEvaluator eval = new LazyStackEvaluator(); QueryEngine qe = new QueryEngine(model, eval, System.out, System.err); Collector<RippleList> expected = new Collector<>();
@Test public void testSimple() throws Exception { ModelConnection mc = getTestModel().createConnection(); Evaluator<RippleList, RippleList, ModelConnection> eval = new LazyStackEvaluator(); Collector<RippleList> expected = new Collector<>(); final Collector<RippleList> actual = new Collector<>();