Gremlin.Net, how to do a Left Outer join?

79 Views Asked by At

I try to understand how to create a request similar to a left outer join in Gremlin.Net.

I have this data :

        using (GremlinClient client = new GremlinClient(new GremlinServer("localhost", 8182)))
        {
            g = AnonymousTraversalSource.Traversal().WithRemote(new DriverRemoteConnection(client));
            g.V().Drop().Iterate();

            var Bob = g.AddV("Person").Property("name", "Bob").ToList()[0];
            var John = g.AddV("Person").Property("name", "John").ToList()[0];
            var Ringo = g.AddV("Person").Property("name", "Ringo").ToList()[0];

            var group1 = g.AddV("Group").Property("name", "Group1").ToList()[0];
            g.V(group1.Id).AddE("in").To(Bob).Iterate();
            g.V(group1.Id).AddE("in").To(John).Iterate();
            g.V(group1.Id).AddE("in").To(Ringo).Iterate();

            var group2 = g.AddV("Group").Property("name", "Group2").ToList()[0];
            g.V(group2.Id).AddE("in").To(Bob).Iterate();

So I have two groups : G1 (with Bob, John, Ringo) and G2 with only Bob. And I want to find the list of groups that don't have a subgroup. How can I do ?

The response I search is : G2, as it is the only group with no subgroup (G1 have G2 as a sub group)

Thanks to help me to understand the way Gremlin.Net works!

0

There are 0 best solutions below