I am new to gremlin and would appreciate some help.
Sample data:
g.addE('Executed').from(g.addV('User').property(id, 'u1')).to(g.addV('Query').property(id, 'q1')).next()
g.addE('Executed').from(g.V().has(id, 'u1')).to(g.addV('Query').property(id, 'q2')).next()
g.addE('Join').from(g.V().has(id, 'q1')).to(g.addV('Table').property("name", "table_1")).next()
g.addE('Join').from(g.V().has("name", 'table_1')).to(g.addV('Table').property("name", "table_2")).next()
g.addE('Join').from(g.V().has(id, 'q2')).to(g.addV('Table').property("name", "table_2")).next()
g.addE('Executed').from(g.addV('User').property(id, 'u2')).to(g.addV('Query').property(id, 'q3')).next()
g.addE('Join').from(g.V().has(id, 'q3')).to(g.addV('Table').property("name", "table_2")).next()
g.V().hasLabel('User')
I have attached two images:
- The first image (img_1) shows the graph I have, It can be created by using the command given above.
- The second image (img_2) shows the desired output.
I want to combine all the table nodes with the same "name" property and get the connected component. The final result must be a "Path" so that I can visualize it in Jupyter Notebook.
Thank you!