Gremlinq Options
GremlinqOption<TValue> is the configuration system for tuning how Gremlinq generates and logs
queries. Options are applied to a query source through ConfigureEnvironment →
ConfigureOptions → SetValue:
source.ConfigureEnvironment(env => env
.ConfigureOptions(options => options
.SetValue(GremlinqOption.SomeOption, value)));
All built-in options are exposed as static properties on the GremlinqOption class
(namespace ExRam.Gremlinq.Core). The IGremlinqOptions interface offers two methods:
SetValue<TValue>(GremlinqOption<TValue>, TValue)— replaces the option's current value.ConfigureValue<TValue>(GremlinqOption<TValue>, Func<TValue, TValue>)— transforms the existing value with a function.
Query generation
FilterLabelsVerbosity
Controls how eagerly Gremlinq emits label filters in traversals.
Type: FilterLabelsVerbosity (enum). Default: Maximum.
Maximum— always emits all label filters. Safe even when the database contains labels that are not part of the model.Minimum— omits label filters when all known types would already be included, producing shorter queries. Only use this when you are sure no unknown labels exist in the database.
DisabledTextPredicates
Declares which TextP.* predicates the target database does not support. Gremlinq will
throw at query-build time if a disabled predicate is used, catching the problem early rather
than at runtime.
Type: DisabledTextPredicates (flags enum). Default: None.
Available flags: Containing, EndingWith, NotContaining, NotEndingWith,
NotStartingWith, StartingWith, Regex, NotRegex.
var source = g
.UseGremlinServer<Vertex, Edge>(_ => _.AtLocalhost())
.ConfigureEnvironment(env => env.UseNewtonsoftJson())
.ConfigureEnvironment(env => env
.ConfigureOptions(opts => opts
.SetValue(GremlinqOption.DisabledTextPredicates, DisabledTextPredicates.Containing | DisabledTextPredicates.EndingWith)));
WorkaroundRangeInconsistencies
Enables a workaround for known range-step inconsistencies present in certain graph databases.
Type: bool. Default: false.
Alias
The traversal source alias used when serializing queries to Groovy script format. Change
this when the graph server expects a traversal source name other than "g" — for example,
when connecting to a named graph on a multi-graph server.
Type: string. Default: "g".
// Change the traversal source alias when the graph server expects a name other than "g"
// (for example, a remote graph named "g2" on a multi-graph server).
var source = g
.UseGremlinServer<Vertex, Edge>(_ => _.AtLocalhost())
.ConfigureEnvironment(env => env.UseNewtonsoftJson())
.ConfigureEnvironment(env => env
.ConfigureOptions(opts => opts
.SetValue(GremlinqOption.Alias, "g2")));
Logging
QueryLogLogLevel
The Microsoft.Extensions.Logging.LogLevel at which Gremlinq emits query text to the
configured logger. Lower the level to reduce noise in production, or raise it to make
queries visible at Information or Warning.
Type: LogLevel. Default: LogLevel.Debug.
QueryLogVerbosity
Controls how much detail is included in each query log entry.
Type: QueryLogVerbosity (flags enum). Default: QueryOnly.
QueryOnly— logs only the query script or bytecode.IncludeBindings— additionally logs the parameter bindings alongside the query.
var source = g
.UseGremlinServer<Vertex, Edge>(_ => _.AtLocalhost())
.ConfigureEnvironment(env => env.UseNewtonsoftJson())
.ConfigureEnvironment(env => env
.ConfigureOptions(opts => opts
.SetValue(GremlinqOption.QueryLogVerbosity, QueryLogVerbosity.QueryOnly | QueryLogVerbosity.IncludeBindings)));