question

gdotv avatar image
gdotv asked Erick Ramirez commented

What is the equivalent for graph.features() in Java for DSG?

Hi,

I'm looking to find out how to determine the graph features (as described in the Gremlin documentation) for a given graph instance in DataStax Enterprise Graph.

With Gremlin Server this can be achieved by submitting a script to the server, "graph.features()".

What's the equivalent for DSG?

Regards,

Arthur

dsegraph
10 |1000

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

1 Answer

gdotv avatar image
gdotv answered Erick Ramirez commented

Hey so with a bit more time spent investigating, I've now figured it out, it turned out to be relatively simple.

So in DSG to get features via Studio, for instance, you would simply send "g.getGraph().features()".

In Java you need to submit the same script, but ensuring that the Client used to send it is aliasing your graph. It's also important to make sure the serializer used by your cluster is GraphSONV2 as features can only be serialized with GraphSON V1/V2. See pseudo code below to achieve this:

Cluster cluster = GetCluster(true); // Fetches the Cluster to connect to DSG using GraphSON V2 as the serializer
Client client = cluster.connect().alias("my_graph_name"); 
Result result = client.submit("g.getGraph().features()").all().get().get(0); 
String[] featuresStringLines = result.getObject().toString().split("\\r?\\n");

Hope this helps others!

1 comment Share
10 |1000

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

Erick Ramirez avatar image Erick Ramirez ♦♦ commented ·
I'm really glad you figured it out. And thanks for circling back and sharing the answer. Cheers!
0 Likes 0 ·