0

I want to query a list and the query response must return to me which response of the list item.

For example:

a = [1,2,3]

graph.V().has("cid", "value", P.within(a)).in_('o_f_c').out('o_f_c').values().toList()

The response of above query is:

[1232131, 4322334, 124334, 354454, 23423423]

The response which I want is:

[[1, [1232131, 4322334]], 
[2, [124334],
[3, [354454,23423423]]

I just dont want to do that in a for loop with python. Is it possible do with gremlin-python?

1 Answer 1

1

I think you just need to group() your results:

g.V().has("cid", "value", P.within(a)).
  group().
    by('cid').
    by(__.in_('o_f_c').out('o_f_c').values().fold()).
  toList()
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much for your response. I just changed the by('cid') with by('value') and import the from gremlin_python.process.graph_traversal import __.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.