gremlin-python: can't add multiple properties at once to an edge

38 views
Skip to first unread message

Matthew Anthony

unread,
Dec 14, 2023, 4:22:15 AM12/14/23
to Gremlin-users
Code is:
g.E(self.edge_id) \
.fold() \
.coalesce(unfold(),
addE(self.edge_type.value)
.from_(__.V(self.from_node_id))
.to(__.V(self.to_node_id))
.property(T.id, self.edge_id)
.property(Cardinality.single, 'tenant', self.tenant)
.property(Cardinality.single, 'from_node_type', self.from_node_type)
.property(Cardinality.single, 'from_node_id', self.from_node_id)
.property(Cardinality.single, 'to_node_type', self.to_node_type)
.property(Cardinality.single, 'to_node_id', self.to_node_id)
.property(Cardinality.single, 'obsts', self.obsts))
.iterate()


Attempting to iterate the above produces the following error:
gremlin_python.driver.protocol.GremlinServerError: 500: org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge cannot be cast to org.apache.tinkerpop.gremlin.structure.Vertex

If I remove all the additional property steps but one, the command will be successful. It's not efficient or feasible to have to submit every property update separately, is this a bug or am I overlooking something?

Kelvin Lawrence

unread,
Dec 18, 2023, 2:44:07 PM12/18/23
to Gremlin-users
I believe this is happening because cardinality is not supported on edges, only on vertices. Just removing the cardinality altogether (for edges) should be fine. Which back end database are you connecting to?

Cheers,
Kelvin
Reply all
Reply to author
Forward
0 new messages