Skip to content Skip to sidebar Skip to footer

Orientdb Gremlin Server Not Working In Python

I am using the orientdb and gremlin server in python, Gremlin server is started successfully, but when I am trying to add one vertex to the orientdb through gremlin code it's givin

Solution 1:

First of all, I very much recommend that you do not use the Graph API to make mutation. Prefer the Traversal API for that and do:

g.addV('Test').
  property('title1', 'abc').
  property('title2', 'abc')

Second, I think that your error is occurring because you are returning a Vertex which contains an ORecordId which is the vertex identifier and Gremlin Server doesn't know how to handle that. I don't know if OrientDB has serializers built to handle that, but if they do then you would want to add them to Gremlin Server configurations which is described in a bit more detail here - basically, you would want to know if OrientDB exposes an TinkerPop IORegistry for all their custom classes that might be sent back over the wire.

If they do not, then you would want to avoid returning those or convert them yourself. TinkerPop already recommends that you not return full Vertex objects and only return data that you need. So, rather than g.V() you would want to convert that Vertex into a Map with g.V().valueMap('title') or something similar (perhaps use project() step). If you definitely need the vertex identifier then you would need to convert that to something TinkerPop serializers understand. That might mean something as simple as:

g.V().has("title1","abc").id().next().toString()

Post a Comment for "Orientdb Gremlin Server Not Working In Python"