+ public static void compileAndEvaluate(ReadGraph graph, Variable context, String expression) throws DatabaseException {
+ SCLContext sclContext = SCLContext.getCurrent();
+ Object oldGraph = sclContext.get("graph");
+ try {
+ CompileSCLMonitorRequest compileSCLMonitorRequest = new CompileSCLMonitorRequest(graph, context) {
+ @Override
+ protected String getExpressionText(ReadGraph graph) throws DatabaseException {
+ return expression;
+ }
+ };
+ Function1<Variable,Object> exp = graph.syncRequest(compileSCLMonitorRequest);
+ sclContext.put("graph", graph);
+ //return exp.apply(context.getParent(graph));
+ } catch (DatabaseException e) {
+ throw (DatabaseException)e;
+ } catch (Throwable t) {
+ throw new DatabaseException(t);
+ } finally {
+ sclContext.put("graph", oldGraph);
+ }
+ }
+