I'm using JanusGraph with the standard python gremlin binding, and I'd like to set a float[]
property on a vertex/edge. However, the Tinkerpop driver for Python doesn't seem able to do so.
For example, here is an example with a script running directly in Groovy:
val = [1.2, 3.4, 5.6]
_client.submit("g.V(4200).property('a', %s as float[])" % val).all().result()
And here is the code that fails when using the gremlin python library:
val = [1.2, 3.4, 5.6]
g.V(4200).property('a', val).next()
Where the error is:
GremlinServerError: 500: Property value [[1.2, 3.4, 5.6]] is of type class java.util.ArrayList is not supported
The error is probably since requests are serialized in GraphSON by the python driver - and GraphSON supports arrays with elements of varying types, thus the Java code behind the scene reads the value as a java.util.ArrayList
which indeed cannot be cast to float[]
.
The question is - is there any sane way to do this, other than writing explicit query strings?