We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a compilation error when building a traversal dynamically.
In my use case, I need to create a chain of Vertices from a dynamic-length list, and avoid creating existing chains (hence the coalesce steps)
Example:
private def createChain(pathInGraph: List[String]) = { val Property = Key[String]("value") val Link = "Link" val Label = "PathComponent" val start = g.V.hasLabel(Label).property(Property -> pathInGraph.head).fold.coalesce( _.unfold[Vertex], _.addV(Label).property(Property -> pathInGraph.head) ) pathInGraph.tail.foldLeft(start) { case (anchor, pathComponentValue) => val step = StepLabel[Vertex]() anchor.as(step).coalesce( _.out(Link).hasLabel(Label).property(Property -> pathComponentValue), _.addV(Label).property(Property -> pathComponentValue).addE(Link).from(step).inV ) } }
However, the above code fails to compile with error:
error: type mismatch; found : gremlin.scala.GremlinScala[org.apache.tinkerpop.gremlin.structure.Vertex]{type Labels = org.apache.tinkerpop.gremlin.structure.Vertex :: shapeless.HNil} required: gremlin.scala.GremlinScala[org.apache.tinkerpop.gremlin.structure.Vertex]{type Labels = shapeless.HNil} anchor.as(step).coalesce( ^
If I remove the labelling step .as(label) it compiles, but then I'm unable to create Edges between the dynamically created chain Vertices.
.as(label)
I'm no expert in Shapeless so it's quite difficult for me to debug and come up with a solution.
Any ideas how I can overcome this error?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There is a compilation error when building a traversal dynamically.
In my use case, I need to create a chain of Vertices from a dynamic-length list, and avoid creating existing chains (hence the coalesce steps)
Example:
However, the above code fails to compile with error:
If I remove the labelling step
.as(label)
it compiles, but then I'm unable to create Edges between the dynamically created chain Vertices.I'm no expert in Shapeless so it's quite difficult for me to debug and come up with a solution.
Any ideas how I can overcome this error?
The text was updated successfully, but these errors were encountered: