I'm able to run this query in the Datastax Studio console and get a tree result back (although it is in malformed json, with all the data returned in the keys instead of values).
g.V().has("mything","key", "mykey")
.emit()
.repeat(outE("contains").inV())
.dedup()
.tree()
.by(
group()
.by(label)
.by(
valueMap()
.unfold()
.group()
.by(select(keys))
.by(select(values).unfold())
)
.unfold()
.unfold()
)
The console result looks like this (notice the strange json format, with the data in the json keys?):
{
"mystuff={dynamicproperties={stuff}, key=mykey}": {
"contains={}": {
"astuff={dynamicproperties=stuff, key=mykey}": {},
"bstuff={dynamicproperties={stuff}, key=mykey}": {},
"container={key=mykey}": {
"contains={}": {
"thing={key=mykey}": {
"contains={}": {
"cstuff={dynamicproperties={stuff}, key=mykey}": {}
}
}
}
}
}
}
}
However when I run it as a SimpleGraphStatement in Gremlin.NET using the CassandraCSharpGraph, it throws this exception: "java.util.HashMap$Node cannot be cast to org.apache.tinkerpop.gremlin.structure.Element"
This is the C# code I run the query:
var graphResultSet = cassandraGraphProvider.Session.ExecuteGraph(new SimpleGraphStatement(query));
I am able to run the statement all the way down to the .dedup() line and get vertices in the graphResultSet, but adding the tree code below that is when it starts throwing the error.
I'm using CassandraCSharpDriver.Graph 2.1, CassandraCSharpDriver 3.14, Gremlin.Net 3.2.9. The server is running dse cassandra 5.1.14 and gremlin 3.2.11.
What is the trick to running a tree query in CassandraCSharpDriver? Any ideas on what I could try next?