Cannot get properties of Elements on remote graph with scalaGraph
See original GitHub issueHi,
Thanks for building this nice wrapper for Scala 😄. I am currently use this on a Remote JanusGraph by calling:
val scalaGraph: ScalaGraph = EmptyGraph.instance().asScala().configure(_.withRemote(DriverRemoteConnection.using(cluster, "g")))
but found I lost some syntax benefit for gremlin-scala, say, if I want to add an edge between v1 and v2, I can no logger call:
val edge = v1 --- ("reference", metadata -> "EdgeTest", deleted -> false) --> v2
Exceptions below:
Edge additions not supported
java.lang.IllegalStateException: Edge additions not supported
at org.apache.tinkerpop.gremlin.structure.Vertex$Exceptions.edgeAdditionsNotSupported(Vertex.java:175)
at org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex.addEdge(ReferenceVertex.java:47)
at gremlin.scala.ScalaVertex.addEdge(ScalaVertex.scala:65)
at gremlin.scala.SemiEdge.$minus$minus$greater(SemiEdge.scala:4)
I believe this is the cause of EmptyGraph as a underlying graph.
referring to this example:
https://github.com/mpollmeier/gremlin-scala-examples/blob/master/dse-graph/src/test/scala/SimpleSpec.scala
instead I have to call
val a = StepLabel[Vertex]() val b = StepLabel[Vertex]() scalaGraph.V(v1.id).as(a).V(v2.id).as(b).addE(REFERENCE).from(a).to(b).property(metadata, "EdgeTest").property(deleted, false).iterate()
this is one of the examples that I cannot use nice wrapper provided by gremlin-scala when I am working on a remote graph, so wondering if i missed sth. here as I am still manipulating on a ScalaGraph or there is a better way to add vertex/edges in remote graph.
Thanks for your help in advance. Alex
Issue Analytics
- State:
- Created 6 years ago
- Comments:37 (15 by maintainers)
Turns out it was user error… You can modify my above example to add this unmodified serializer and it will function properly
Thanks for the great work bringing gremlin to scala!
@nkconnor @mpollmeier For neptune I’m using the following setup. Still new to gremlin, so not sure how much of this is specific to issues with Neptune. I sort of walked it back from using idomatic (gremlin-)scala in a lot of areas, but am still able to use the
g + CC
functionality.Like @hudsonmd said, adding the following serializer is important:
And then for retrieving an item map with properties:
Calling the valueMap before head is important if you want properties - also calling head seems to stop a traversal, so something like
.head().out()
I don’t think works.Updates for properties in neptune seem to only work if you first delete the property. I was running into this gnarly bug where if you try to increase the property value of a Double it works, but if you try to decrease it it does not.