Gremlinq.Extensions.Strategies
Includes CosmosDb provider packages
Purchasing this product also grants access to the CosmosDb provider packages for ExRam.Gremlinq 13 via the paid private NuGet feed. Transition details: CosmosDb provider packages transition.
Introduction
TinkerPop's traversal strategy system is a server-side mechanism that lets the graph engine modify how a traversal
is executed — reordering filters, enforcing constraints, scoping reads and writes to a partition, and more. Strategies
are declared as part of the traversal itself using withStrategies(...) and withoutStrategies(...) steps; the
server interprets and applies them.
Gremlinq.Extensions.Strategies provides strongly-typed .NET representations of TinkerPop strategies with fluent
builders, and handles their serialization into the bytecode sent to the server. The WithStrategy and
WithoutStrategy extension methods on IGremlinQuerySource are how you attach or remove a strategy per-query
or for the lifetime of the source.
Support varies by provider — CosmosDb in particular only honours a small subset of TinkerPop strategies. Consult your provider's documentation to confirm which strategies are accepted.
Supported strategies
This product includes two packages. Gremlinq.Extensions.Strategies covers the general TinkerPop strategy
set; Gremlinq.Extensions.Strategies.CosmosDb adds the CosmosDb-specific strategies below.
General TinkerPop:
AdjacentToIncidentStrategyConnectiveStrategyCountStrategyEarlyLimitStrategyEdgeLabelVerificationStrategyElementIdStrategyFilterRankingStrategyGraphFilterStrategyHaltedTraverserStrategyIdentityRemovalStrategyIncidentToAdjacentStrategyInlineFilterStrategyLambdaRestrictionStrategyLazyBarrierStrategyMatchAlgorithmStrategyMatchPredicateStrategyOptionsStrategyOrderLimitStrategyPartitionStrategyPathProcessorStrategyPathRetractionStrategyProductiveByStrategyReadOnlyStrategyRepeatUnrollStrategyReservedKeysVerificationStrategySeedStrategySubgraphStrategyVertexProgramStrategy
CosmosDb only:
PartitionStrategyProjectionStrategy
Setup
After setting up our NuGet package server with your license key, add the package(s) to your project
In your app's initial setup of IGremlinQuerySource, configure the environment and add a call
to AddStrategySupport, like shown below:
using static ExRam.Gremlinq.Core.GremlinQuerySource;
// (Incomplete) example provider setup and Gremlinq.Extensions.Strategies setup
var source = g
.UseGremlinServer<Vertex, Edge>(_ => _
.AtLocalhost())
.ConfigureEnvironment(env => env
.AddStrategySupport());
For CosmosDb, AddCosmosDbStrategySupport must be called instead. It is not necessary to
call both, AddCosmosDbStrategySupport and AddStrategySupport:
using static ExRam.Gremlinq.Core.GremlinQuerySource;
// (Incomplete) example provider setup and Gremlinq.Extensions.Strategies setup
var source = g
.UseCosmosDb<Vertex, Edge>(_ => _
.AtLocalhost("db", "graph"))
.ConfigureEnvironment(env => env
.AddCosmosDbStrategySupport());
Usage examples
- General TinkerPop
using static ExRam.Gremlinq.Core.GremlinQuerySource;
// Usage example:
await source
.WithStrategy(SubgraphStrategy
.Build()
.Vertices(__ => __
.Cast<Airport>()
.Where(x => x.Country == "US"))
.Create())
.V();
- CosmosDb
using static ExRam.Gremlinq.Core.GremlinQuerySource;
// (Incomplete) example provider setup and Gremlinq.Extensions.Strategies.CosmosDb setup
var source = g
.UseCosmosDb<Vertex, Edge>(_ => _
.AtLocalhost("db", "graph"))
.ConfigureEnvironment(env => env
.AddCosmosDbStrategySupport());
/* Usage example: ... */
await source
.WithStrategy(ProjectionStrategy
.Build()
.IncludeSystemProperties(SystemProperty._etag, SystemProperty._self)
.Create())
.V();
await source
.WithStrategy(PartitionStrategy
.Build()
.PartitionKey("PartitionKey")
.ReadPartitions("_partition_1")
.Create())
.V();
Further reading:
Pricing
| Developer Seats | Price per seat (€) / year (excl. tax) |
|---|---|
| For the first 1 to 5 | 199.00 |
| For the next 6 to 20 | 67.00 |
| For the rest | included |
Need a bundled offer? Reach out at info@danielcweber.net.