Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

Ryan Quey avatar image
Ryan Quey asked ·

Does GraphTraversal take type parameters?

I am using DSE Java Driver v1.7. In those docs, it appears that somehow `GraphTraversal` does not have any type parameters:

GraphTraversal traversal = g.V().has("name", "marko"); // Java-based Gremlin Traversal API, more comfortable than a String

However, looking at docs for Java Driver 4.9, they do:

GraphTraversal<Vertex, Vertex> traversal = g.V().has("name", "marko");

When looking at the Tinkerpop docs, it looks like there should be type parameters specified. From their java docs:

Interface GraphTraversal<S,E>

Is it just that the DSE java driver 1.7 docs are incorrect? Or where they referring to a different interface than what I linked to in the Tinkerpop docs?

graphjava driver
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

Yes, you are right. I've confirmed with Bryn Cooke from the Graph team that both of these are supported:

GraphTraversal traversal = g.V().has("name", "marko");
GraphTraversal<Vertex, Vertex> traversal = g.V().has("name", "marko");

but it just wasn't documented in Java driver 1.7. Tinkerpop traversals have always had type parameters.

On a side note, the DSE Java driver is no longer maintained so we don't recommend its use anymore.The DSE Java driver and the Cassandra Java driver were unified earlier this year under a single fully open-source Java driver from version 4.4 (see the blog post Better Drivers for Cassandra).

This means that the same driver can be used to connect to either an Apache Cassandra cluster or a DSE cluster. DSE features are available when the driver is connected to a DSE cluster. Cheers!

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@Ryan Quey,

in addition to Erick's answer, if you are using DSE Graph 6.8, as it seems from other questions, you will not be able to use the DSE Java Driver 1.7, as it does not support the correct protocol required for Graph 6.8.

You will have to use the newer unified drivers, recommend to use the latest, 4.9.

As per your question, I ran a quick test with 4.9, and both options (with specified types and without) are still supported in 4.9.

Cheers!

1 Like 1 · ·