Pattern Matching Error

121 views
Skip to first unread message

K Major

unread,
Apr 21, 2016, 2:04:34 PM4/21/16
to Gremlin-users
Hello,
I'ml looking the graoh for the follwing pattern 


























Where A goes to B and C such that those 2 are connected

I have written the following query to look for it the graph

list = g.V().match(
   __.as("a").has("name",1), //TODO doesn't work without this line
                   __.as("a").out().where(P.neq("a")).as("b"),
                   __.as("b").out().where(P.neq("a").and(P.neq("b"))).as("c"),
                   __.as("a").out().where(P.eq("c")) ).
 select("a","b","c").by("name").toList();


It works well but I need to specify that A has name equal to 1.

I would like that this query look on all the graph searching for this pattern, so i would like to remove the first line

However, if I do so, I get the error :  Neither the sideEffects, map, nor path has a c-key: WherePredicateStep(eq(c))


Daniel Kuppitz

unread,
Apr 21, 2016, 2:24:23 PM4/21/16
to gremli...@googlegroups.com
That query just worked for me:

g.V().match(
    __.as("a").out().as("b"),
    __.as("b").out().as("c"),
    __.as("a").out().as("c")
  ).where("a", neq("b")).where("a", neq("c")).where("b", neq("c")).select("a","b","c")


However, I like this one a bit more:

g.V().as("a").
  out().where(neq("a")).as("b").
  out().where(neq("a").and(neq("b"))).as("c").
  where(out().as("b").and().in().as("a")).
  select("a","b","c")

Cheers,
Daniel




--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/91fd6f14-9070-4f99-ade4-f697045148dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages