Submitting DSE Graph queries with the DataStax drivers

The DataStax drivers expose the String API and Fluent API for executing DSE Graph traversals.

The DataStax drivers expose the String API and Fluent API for executing DSE Graph traversals.

Graph use cases are characterized by highly connected data. Traversing these connections is essential for solving modern fraud detection and personalization use cases. To address the emerging demand of the Graph database, DataStax invests heavily into the Apache TinkerPop graph computing framework that leverages Gremlin as its property graph query language and core API. The DataStax drivers expose several interfaces for executing DSE Graph traversals:
  • Fluent API (analogous to TinkerPop Bytecode API)
  • String API (analogous to TinkerPop Script API)
  • remote traversal sources for full compatibility with TinkerPop’s execution model
DataStax recommendes Fluent API as the interface for graph traversals.

Fluent API

The DataStax drivers Graph Fluent API leverages TinkerPop’s Gremlin Language Variants and allows developers to programmatically construct Gremlin traversals and execute the compiled bytecode through a DSE session, similar to standard CQL queries. This interface is recommended for all new DSE Graph applications.

Figure: DSE Graph Fluent API

DSE Graph Fluent API
Table 1. Fluent API for drivers
C/C++ (not supported) C# Java Node.js PHP (not supported) Python Ruby (not supported)

String API

The String API is a more limited interface than the Fluent API. The String API simply passes Gremlin Groovy strings through the DataStax Driver to the DSE Graph server.

Table 2. String API for drivers
C/C++ C# Java Node.js PHP Python Ruby

Remote traversal source

The DataStax drivers allow a TinkerPop GraphTraversalSource to be remotely connected to DSE Graph. This source lends full compatibility with TinkerPop types and uses an implicit execution model through the TinkerPop terminal steps.

Note: The results for a GraphTraversalSource are detached from the server. Modifications to the remote elements do not directly affect the data stored in DSE Graph.
Table 3. Remote traversal source for drivers
C/C++ (not supported) C# Java Node.js PHP (not supported) Python Ruby (not supported)

Domain Specific Languages

Domain Specific Languages (DSLs) simplify code and provide concise APIs for DSE Graph applications. DSLs allow the developer to abstract the underlying Gremlin code that is traversing the DSE property graph into usable methods that are tailored to the application.

Table 4. Domain Specific Languages for drivers
C/C++ (not supported) C# Java Node.js* (not supported) PHP (not supported) Python Ruby (not supported)

User-defined IDs

Partition and clustering keys in DSE Core extend to DSE Graph. Use partition and clustering keys when creating vertex labels. Vertex labels more effectively distribute the data throughout the cluster and gives the user control over where the data is distributed.