Reputation: 359
We currently use gremlin.net library in a net core 3.0 application to connect to Janusgraph db.
We need to execute below query in janusgraph
g.V('12345').outE('myedge').has('datetime',lt(1581922847)).order().by('datetime', incr).limit(100).valueMap().as('time').inV().as('user').select('time','user')
The query runs fine as long as we dont have inV()
part. If we have inV()
, we are facing below error,
ScriptEvaluationError: java.util.LinkedHashMap cannot be cast to org.apache.tinkerpop.gremlin.structure.Edge
To have a simpler example, the query g.V(1).as('v').outE().limit(1).as('e').select('v','e')
works directly in gremlin console but not with gremlin.net
library(groovy-string) for janusgraph. We have tried both GRYO and GraphSON Serializer settings in server. We are in a position to use groovy-string as this is an existing application.
Upvotes: 0
Views: 400
Reputation: 25
I would use the JanusGraph.Net nuget package! since there are JanusGraph-specific types that Gremlin.Net can't serialize.
Upvotes: 1
Reputation: 46226
The query runs fine as long as we dont have inV() part. If we have inV(), we are facing below error, ScriptEvaluationError
You can't have inV()
because it follows valueMap()
. inV()
is meant to traverse from an Edge
object to its incoming Vertex
, but valueMap()
converts the Edge
to a Map
and you thus get the error of: "java.util.LinkedHashMap cannot be cast to org.apache.tinkerpop.gremlin.structure.Edge"
I think you just want:
g.V('12345').
outE('myedge').has('datetime',lt(1581922847)).
order().by('datetime', incr).
limit(100).
project('time','user').
by(valueMap()).
by(inV())
Upvotes: 3