I am in a situation where I need to get two different types of vertices using a single query. For example, assume that the graph has the following structure :
Node("User")--Edge("is_member")-->Node("Membership")--Edge("is_member")-->Node("Group")
Assume that the nodes have the following properties:
- Membership
- status
- date
- Group
- name
- date
- type
Now, I need to get all the Membership nodes that a user is_member of, along with the corresponding Group's name. How do I write a Gremlin query for this?
I am using the Bulbs framework. How do I store the result in a python object?
The following query gives you for user
u1a map withkey = Membership-Nodes andvalue = list of group names of the key membership node:Output is:
Here the used sample graph:
See also: How do I write a sub-query?
(tested with gremlin2)