executeGremlinQuery method

Future<ExecuteGremlinQueryOutput> executeGremlinQuery({
  1. required String gremlinQuery,
  2. String? serializer,
})

This commands executes a Gremlin query. Amazon Neptune is compatible with Apache TinkerPop3 and Gremlin, so you can use the Gremlin traversal language to query the graph, as described under The Graph in the Apache TinkerPop3 documentation. More details can also be found in Accessing a Neptune graph with Gremlin.

When invoking this operation in a Neptune cluster that has IAM authentication enabled, the IAM user or role making the request must have a policy attached that enables one of the following IAM actions in that cluster, depending on the query:

Note that the neptune-db:QueryLanguage:Gremlin IAM condition key can be used in the policy document to restrict the use of Gremlin queries (see Condition keys available in Neptune IAM data-access policy statements).

May throw BadRequestException. May throw CancelledByUserException. May throw ClientTimeoutException. May throw ConcurrentModificationException. May throw ConstraintViolationException. May throw FailureByQueryException. May throw IllegalArgumentException. May throw InvalidArgumentException. May throw InvalidParameterException. May throw MalformedQueryException. May throw MemoryLimitExceededException. May throw MissingParameterException. May throw ParsingException. May throw PreconditionsFailedException. May throw QueryLimitExceededException. May throw QueryLimitException. May throw QueryTooLargeException. May throw TimeLimitExceededException. May throw TooManyRequestsException. May throw UnsupportedOperationException.

Parameter gremlinQuery : Using this API, you can run Gremlin queries in string format much as you can using the HTTP endpoint. The interface is compatible with whatever Gremlin version your DB cluster is using (see the Tinkerpop client section to determine which Gremlin releases your engine version supports).

Parameter serializer : If non-null, the query results are returned in a serialized response message in the format specified by this parameter. See the GraphSON section in the TinkerPop documentation for a list of the formats that are currently supported.

Implementation

Future<ExecuteGremlinQueryOutput> executeGremlinQuery({
  required String gremlinQuery,
  String? serializer,
}) async {
  final headers = <String, String>{
    if (serializer != null) 'accept': serializer.toString(),
  };
  final $payload = <String, dynamic>{
    'gremlin': gremlinQuery,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/gremlin',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ExecuteGremlinQueryOutput.fromJson(response);
}