GremlinExtension extends AbstractRexsterExtension { @ExtensionDefinition(extensionPoint = ExtensionPoint.VERTEX, method = HttpMethod.GET) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for a vertex.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) public ExtensionResponse evaluateGetOnVertex(@RexsterContext RexsterResourceContext rexsterResourceContext, @RexsterContext Graph graph, @RexsterContext Vertex vertex, @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script) { return tryExecuteGremlinScript(rexsterResourceContext, graph, vertex, null, script); }  @ExtensionDefinition(extensionPoint = ExtensionPoint.EDGE, method = HttpMethod.GET) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for an edge.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) ExtensionResponse evaluateGetOnEdge(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                               @RexsterContext Graph graph,
                                               @RexsterContext Edge edge,
                                               @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script); @ExtensionDefinition(extensionPoint = ExtensionPoint.EDGE, method = HttpMethod.POST) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for an edge.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) ExtensionResponse evaluatePostOnEdge(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                @RexsterContext Graph graph,
                                                @RexsterContext Edge edge,
                                                @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script); @ExtensionDefinition(extensionPoint = ExtensionPoint.VERTEX, method = HttpMethod.GET) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for a vertex.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) ExtensionResponse evaluateGetOnVertex(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                 @RexsterContext Graph graph,
                                                 @RexsterContext Vertex vertex,
                                                 @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script); @ExtensionDefinition(extensionPoint = ExtensionPoint.VERTEX, method = HttpMethod.POST) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for a vertex.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) ExtensionResponse evaluatePostOnVertex(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                  @RexsterContext Graph graph,
                                                  @RexsterContext Vertex vertex,
                                                  @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script); @ExtensionDefinition(extensionPoint = ExtensionPoint.GRAPH, method = HttpMethod.GET) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for a graph.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) ExtensionResponse evaluateGetOnGraph(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                @RexsterContext Graph graph,
                                                @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script); @ExtensionDefinition(extensionPoint = ExtensionPoint.GRAPH, method = HttpMethod.POST) @ExtensionDescriptor(description = "evaluate an ad-hoc Gremlin script for a graph.", api = { @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.SHOW_TYPES, description = API_SHOW_TYPES), @ExtensionApi(parameterName = LANGUAGE, description = API_LANGUAGE), @ExtensionApi(parameterName = PARAMS, description = API_PARAMS), @ExtensionApi(parameterName = LOAD, description = API_LOAD), @ExtensionApi(parameterName = RETURN_TOTAL, description = API_RETURN_TOTAL), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.RETURN_KEYS, description = API_RETURN_KEYS), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_START, description = API_START_OFFSET), @ExtensionApi(parameterName = Tokens.REXSTER + "." + Tokens.OFFSET_END, description = API_END_OFFSET) }) ExtensionResponse evaluatePostOnGraph(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                 @RexsterContext Graph graph,
                                                 @ExtensionRequestParameter(name = SCRIPT, description = API_SCRIPT, parseToJson = false) String script); static final String EXTENSION_NAMESPACE; static final String EXTENSION_NAME; }
@Test public void evaluateGetOnVertexNoKeysNoTypesReturnOutEdges() { ExtensionResponse extensionResponse = this.gremlinExtension.evaluateGetOnVertex( rexsterResourceContext, graph, graph.getVertex(6), "v.outEdges"); JSONObject jsonResponse = assertResponseAndGetEntity(extensionResponse, Response.Status.OK.getStatusCode()); Assert.assertNotNull(jsonResponse); Assert.assertTrue(jsonResponse.has("results")); JSONArray jsonResults = jsonResponse.optJSONArray("results"); Assert.assertNotNull(jsonResults); Assert.assertEquals(1, jsonResults.length()); }