You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// create graphson object and dump it to the file graphson.txt
val g = TinkerGraph.open()
val gScala = g.asScala
val v = gScala.addVertex("Node", ("ip", "192.168.1.1"), ("ip", "192.168.1.2"), ("ip", "192.168.1.3"))
val mapper = g.io(IoCore.graphson).mapper.normalize(true).version(GraphSONVersion.V2_0).create
g.io(IoCore.graphson).writer.mapper(mapper).create.writeGraph(new FileOutputStream("./graphson.txt"), g)
println(gScala.V().hasLabel("Node").has(Key[String]("ip"), "192.168.1.1").headOption()) // Some(v[0])
println(gScala.V().hasLabel("Node").has(Key[String]("ip"), "192.168.1.2").headOption()) // Some(v[0])
println(gScala.V().hasLabel("Node").has(Key[String]("ip"), "192.168.1.3").headOption()) // Some(v[0])
// load it from file
val gNew = TinkerGraph.open()
val gScalaNew = gNew.asScala()
val s: InputStream = new FileInputStream("./graphson.txt")
gNew.io(IoCore.graphson()).reader().create().readGraph(s, gNew)
// try to operate it
println(gScalaNew.V().hasLabel("Node").has(Key[String]("ip"), "192.168.1.1").headOption()) // None (Why this is None?)
println(gScalaNew.V().hasLabel("Node").has(Key[String]("ip"), "192.168.1.2").headOption()) // None (Why this is None?)
println(gScalaNew.V().hasLabel("Node").has(Key[String]("ip"), "192.168.1.3").headOption()) // Some(v[0])
The text was updated successfully, but these errors were encountered:
When you switch to graphML you see what's wrong: g.io(IoCore.graphml).writeGraph("./graphml.xml")
leads to: Multiple properties exist for the provided key, use Vertex.properties(ip) at org.apache.tinkerpop.gremlin.structure.Vertex$Exceptions.multiplePropertiesExistForProvidedKey(Vertex.java:179)
Looks like there's a problem with multi-properties and graph serialisation in gremlin-core. I've just tried it with gremlin-groovy which has the same problem:
graph = TinkerGraph.open()
g = graph.traversal()
v = g.addV().property('name','marko').property('name','marko a. rodriguez').next()
g.V(v).properties('name').count() //2
graph.io(IoCore.graphml()).writeGraph("multiprop.xml")
// error: Multiple properties exist for the provided key, use Vertex.properties(name)
Here is the source code:
The text was updated successfully, but these errors were encountered: