Gremlin.of(g).v(1).union(Gremlin.of().out("knows"),Gremlin.of().out("created").in("created")).value("name").forEach(System.out::println);//////vadasjoshjoshpetermarko
Gremlin.of(g).v(1).union(Gremlin.of().out("knows"),Gremlin.of().out("created").in("created")).value("name").path().forEach(System.out::println);/////[v[1], v[2], vadas][v[1], v[3], v[4], josh][v[1], v[4], josh][v[1], v[3], v[6], peter][v[1], v[3], v[1], marko]
Gremlin.of(g).v(1).as("x").union(Gremlin.of().out("knows"),Gremlin.of().out("created").in("created")).jump("x", h -> h.getLoops() < 2).value("name").path().forEach(System.out::println);//////[v[1], v[3], v[4], v[3], v[4], josh][v[1], v[3], v[4], v[3], v[6], peter][v[1], v[3], v[4], v[3], v[1], marko][v[1], v[3], v[4], v[5], v[4], josh][v[1], v[4], v[3], v[4], josh][v[1], v[4], v[3], v[6], peter][v[1], v[4], v[3], v[1], marko][v[1], v[4], v[5], v[4], josh][v[1], v[3], v[6], v[3], v[4], josh][v[1], v[3], v[6], v[3], v[6], peter][v[1], v[3], v[6], v[3], v[1], marko][v[1], v[3], v[1], v[2], vadas][v[1], v[3], v[1], v[3], v[4], josh][v[1], v[3], v[1], v[4], josh][v[1], v[3], v[1], v[3], v[6], peter][v[1], v[3], v[1], v[3], v[1], marko]
Love it. Do you still need OR step then ?
Could do union(...) and then a BACK step.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
Gremlin.of(g).V().intersect(
Gremlin.of().out("knows"),Gremlin.of().out("created")
).path(v -> ((Vertex) v).getValue("name")).forEach(System.out::println);
[marko, vadas][marko, lop][marko, josh]
Gremlin.of(g).V().match("a", "b",Gremlin.of().as("a").identity().as("b"),Gremlin.of().as("b").out("knows"),Gremlin.of().as("b").out("created")).path(v -> ((Vertex) v).getValue("name")).forEach(System.out::println);
[marko]
Gremlin.of(g).V().match("a", "b",Gremlin.of().as("a").out("knows").as("b"),Gremlin.of().as("a").out("created").as("b")).path(v -> ((Vertex) v).getValue("name")).forEach(System.out::println);
"What are the vertices that some vertex in V knows AND created."
Gremlin.of(g).V().intersect(
Gremlin.of().out("knows"),
Gremlin.of().out("created")
).path(v -> ((Vertex) v).getValue("name")).forEach(System.out::println);
The result being, of course, those things that 'marko' knows and created as he is the only vertex in the toy graph that both knows someone and has created something.
[marko, vadas]
[marko, lop]
[marko, josh]
Gremlin.of(g).V().match("a", "b",
Gremlin.of().as("a").out("knows").as("b"),
Gremlin.of().as("a").out("created").as("b")
).path(v -> ((Vertex) v).getValue("name")).forEach(System.out::println);
Gremlin.of(g).V().intersect(Gremlin.of().out("created"),Gremlin.of().both("knows").out("created")
).path(v -> ((Vertex) v).getValue("name")).forEach(System.out::println);
[marko, lop] # marko knows josh and marko and josh created lop[josh, lop] # josh knows marko and josh and marko created lop
// uniongremlin> g.V().hasLabel("person").union(has("age", lte(29)), has("age", gte(29))).valueMap()==>[name:[marko],age:[29]]==>[name:[marko],age:[29]]==>[name:[vadas],age:[27]]==>[name:[josh],age:[32]]==>[name:[peter],age:[35]]// intersectiongremlin> g.V().hasLabel("person").has("age", lte(29)).aggregate("x").has("age", gte(29)).where(within("x")).valueMap()==>[name:[marko],age:[29]]// differencegremlin> g.V().hasLabel("person").union(has("age", lte(29)).store("x"), has("age", gte(29)).store("y")).barrier().union(where(without("x")), where(without("y"))).valueMap()==>[name:[vadas],age:[27]]==>[name:[josh],age:[32]]==>[name:[peter],age:[35]]
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/6b98b0e3-8322-4a56-8cd1-90828e8ca87e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CA%2Bf9seWHR0wDgFzF8Y62vo8yv9UuMnDbW7KXuFyWbS_LdKRRew%40mail.gmail.com.
gremlin>graph = TinkerFactory.createModern()gremlin>g = graph.traversal()g.V().hasLabel('person').has('name', 'vadas').in('knows').hasLabel('person').valueMap()
g.V().hasLabel('software').has('name', 'lop').in('created').hasLabel('person').valueMap(
g.V().union(g.V().hasLabel('person').has('name', 'vadas').in('knows').hasLabel('person'),g.V().hasLabel('software').has('name','lop').in('created').hasLabel('person')).dedup().valueMap()--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/d8ae9f45-32a4-4b08-8e93-1952e96a8c8b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CABed_4pd0YrajA6dGSF_%2BhKeBpcexYQVbsb38TenMpz2iLXg1A%40mail.gmail.com.
Thanks Robert, Stephen.
Hey would union query require a scan over all vertices?
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/2779a5e2-fc2d-4afd-9f11-83d192325cf5%40googlegroups.com.
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/45ee870f-e273-4198-8582-79d02fb33217%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CAA-H43-bVcvX33WuoZjhfgHkAMN1XWPuwQS%3DO7RyE_VnYnZzCA%40mail.gmail.com.
Hey Robert,
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/524af641-9b74-416f-8969-accd0f0ead09%40googlegroups.com.