2

Trying to create edges between vertices using gremlin-python, but it is not working

jupyter notebook

"g.V('ProdDev').addE('belongs').to(g.V('Dept'))"

edges should create....currently empty edges are creating...

Vladimir Alexiev
  • 2,477
  • 1
  • 20
  • 31
  • Can you also post some examples of your data? – cwalvoort May 20 '19 at 21:54
  • "g.addV('ProductDevelopment').property('ProductDevID',"+"012345").property('ProductDevName',"+"skinny") " "g.addV('Season').property('Season',2019)" created two vertices using this gremlin query, now I need to create edge between vertices. For that I'm using query as "g.V('ProductDev').addE('belongs').to(g.V('Season'))" but edge is not creating in database – Vijay kotikalapudi May 21 '19 at 05:14

1 Answers1

1

When you use

g.addV('Season')

that creates a vertex with the label Season.

However, when you use

g.V('Season')

Gremlin is looking for a vertex with an ID (not a label) of Season.

If you need to use the label you can do

g.V().hasLabel('Season')

Also, mid traversal, you should not use g.V() rather you should do

to(V().hasLabel('Season'))
Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38